mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:45:33 +00:00
Player spawning and isometric in menu
This commit is contained in:
parent
a11f25e19d
commit
1229613def
10 changed files with 286 additions and 43 deletions
|
|
@ -23,14 +23,18 @@ public partial class CameraController3D : Camera3D
|
|||
|
||||
[Export] public NodePath TargetPath;
|
||||
|
||||
private Node3D _target;
|
||||
private CameraTarget3D _target;
|
||||
private Vector3 _currentPosition = Vector3.Zero;
|
||||
private Vector3 _currentAimOffset = Vector3.Zero;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Instance = this;
|
||||
_target = GetNode<Node3D>(TargetPath);
|
||||
|
||||
RotationDegrees = new Vector3(-45f, 45f, 0f);
|
||||
Projection = ProjectionType.Orthogonal;
|
||||
|
||||
_target = GetNode<CameraTarget3D>(TargetPath);
|
||||
if (_target == null)
|
||||
{
|
||||
GD.PushError("Camera target not found.");
|
||||
|
|
@ -40,13 +44,22 @@ public partial class CameraController3D : Camera3D
|
|||
_currentPosition = GlobalPosition;
|
||||
|
||||
// Set fixed isometric angle once: -45° X tilt, 45° Y pan
|
||||
RotationDegrees = new Vector3(-45f, 45f, 0f);
|
||||
Projection = ProjectionType.Orthogonal;
|
||||
|
||||
}
|
||||
|
||||
public void RegisterTarget(CameraTarget3D target, bool jump = true)
|
||||
{
|
||||
// assert(not _active_target)
|
||||
_target = target;
|
||||
if (jump)
|
||||
{
|
||||
//_currentPosition = _activeTarget.GlobalPosition;
|
||||
}
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (_target == null) return;
|
||||
if (_target is null) return;
|
||||
|
||||
float dt = (float)delta;
|
||||
Vector3 targetPos = _target.GlobalTransform.Origin;
|
||||
|
|
|
|||
16
Scripts/Misc/CameraTarget3D.cs
Normal file
16
Scripts/Misc/CameraTarget3D.cs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Misc;
|
||||
|
||||
public partial class CameraTarget3D : Marker3D
|
||||
{
|
||||
public override void _Ready()
|
||||
{
|
||||
// register with the controller
|
||||
var res = GetTree().GetFirstNodeInGroup("camera_controllers");
|
||||
if (res is CameraController3D cameraController)
|
||||
{
|
||||
cameraController.RegisterTarget(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
1
Scripts/Misc/CameraTarget3D.cs.uid
Normal file
1
Scripts/Misc/CameraTarget3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dnslcy71dgea
|
||||
Loading…
Add table
Add a link
Reference in a new issue