basic targeting system
This commit is contained in:
@@ -22,7 +22,7 @@ public partial class DashSystem: Node3D
|
||||
public Vector3 PlannedMantleLocation { get; set; }
|
||||
public MantleSystem MantleSystem { get; set; }
|
||||
|
||||
private Node3D _head;
|
||||
private HeadSystem _head;
|
||||
private ShapeCast3D _dashCast3D;
|
||||
private Camera3D _camera;
|
||||
private Vector3 _dashDirection = Vector3.Zero;
|
||||
@@ -49,7 +49,7 @@ public partial class DashSystem: Node3D
|
||||
|
||||
public float DashCastRadius { get; set; }
|
||||
|
||||
public void Init(Node3D head, Camera3D camera)
|
||||
public void Init(HeadSystem head, Camera3D camera)
|
||||
{
|
||||
_dashCast3D = GetNode<ShapeCast3D>("DashCast3D");
|
||||
var dashShape = _dashCast3D.GetShape() as SphereShape3D;
|
||||
@@ -93,10 +93,7 @@ public partial class DashSystem: Node3D
|
||||
|
||||
public void PrepareDash()
|
||||
{
|
||||
_dashCast3D.SetRotation(new Vector3(
|
||||
_camera.Rotation.X,
|
||||
_head.Rotation.Y,
|
||||
_camera.Rotation.Z));
|
||||
_dashCast3D.SetRotation(_head.GetGlobalLookRotation());
|
||||
|
||||
(HasHit, PlannedLocation, CollisionPoint, CollisionNormal) = ComputeDashLocation();
|
||||
|
||||
|
||||
@@ -310,6 +310,14 @@ public partial class HeadSystem : Node3D
|
||||
return GetGlobalTransform().Basis.Z;
|
||||
}
|
||||
|
||||
public Vector3 GetGlobalLookRotation()
|
||||
{
|
||||
return new Vector3(
|
||||
_camera.Rotation.X,
|
||||
Rotation.Y,
|
||||
_camera.Rotation.Z);
|
||||
}
|
||||
|
||||
public void SetHeight(float height)
|
||||
{
|
||||
Position = new Vector3(Position.X, height, Position.Z);
|
||||
|
||||
Reference in New Issue
Block a user