Minor cleanup.
parent
d2611c6073
commit
71162f9420
|
@ -37,9 +37,9 @@ public class GroundMotionComponent : Component
|
||||||
|
|
||||||
private void CalcPlaneVelocity(float delta, Entity entity, Vector3 targetPosition)
|
private void CalcPlaneVelocity(float delta, Entity entity, Vector3 targetPosition)
|
||||||
{
|
{
|
||||||
Vector2 planeTargetDirection = new Vector2(DirectionToTarget.x, DirectionToTarget.z);
|
Vector2 planeTargetDirection = new(DirectionToTarget.x, DirectionToTarget.z);
|
||||||
|
|
||||||
Vector2 planeVelocity = new Vector2(entity.Velocity.x, entity.Velocity.z);
|
Vector2 planeVelocity = new(entity.Velocity.x, entity.Velocity.z);
|
||||||
// GD.Print("-- Step: distance: " + targetDistance + " dir: " + planeTargetDirection + " speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized());
|
// GD.Print("-- Step: distance: " + targetDistance + " dir: " + planeTargetDirection + " speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized());
|
||||||
planeVelocity -= planeVelocity * Damping;
|
planeVelocity -= planeVelocity * Damping;
|
||||||
// GD.Print(" damp : speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized());
|
// GD.Print(" damp : speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized());
|
||||||
|
@ -53,7 +53,7 @@ public class GroundMotionComponent : Component
|
||||||
planeVelocity = planeVelocity.Length() * planeTargetDirection + planeTargetDirection * Accel * delta;
|
planeVelocity = planeVelocity.Length() * planeTargetDirection + planeTargetDirection * Accel * delta;
|
||||||
// GD.Print(" accel: speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized());
|
// GD.Print(" accel: speed: " + planeVelocity.Length() + " vel dir: " + planeVelocity.Normalized());
|
||||||
|
|
||||||
var projectedStep = planeTargetDirection.Dot(planeVelocity * delta);
|
float projectedStep = planeTargetDirection.Dot(planeVelocity * delta);
|
||||||
// GD.Print(" Projected step: " + projectedStep + " Speed: " + planeVelocity.Length() + " delta: " + delta);
|
// GD.Print(" Projected step: " + projectedStep + " Speed: " + planeVelocity.Length() + " delta: " + delta);
|
||||||
if (projectedStep > DistanceToTarget)
|
if (projectedStep > DistanceToTarget)
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ public class GroundMotionComponent : Component
|
||||||
// GD.Print(" corr speed: " + planeVelocity.Length() + " step: " + projectedStep);
|
// GD.Print(" corr speed: " + planeVelocity.Length() + " step: " + projectedStep);
|
||||||
}
|
}
|
||||||
|
|
||||||
var planeSpeed = planeVelocity.Length();
|
float planeSpeed = planeVelocity.Length();
|
||||||
if (planeSpeed > MaxSpeed) planeVelocity *= MaxSpeed / planeSpeed;
|
if (planeSpeed > MaxSpeed) planeVelocity *= MaxSpeed / planeSpeed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -88,6 +88,7 @@ script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="MountPoint" type="Spatial" parent="."]
|
[node name="MountPoint" type="Spatial" parent="."]
|
||||||
transform = Transform( -0.524001, 0, -0.851718, 0, 1, 0, 0.851718, 0, -0.524001, 0.717306, 0, 0.400936 )
|
transform = Transform( -0.524001, 0, -0.851718, 0, 1, 0, 0.851718, 0, -0.524001, 0.717306, 0, 0.400936 )
|
||||||
|
visible = false
|
||||||
|
|
||||||
[node name="Arrow" type="Spatial" parent="MountPoint"]
|
[node name="Arrow" type="Spatial" parent="MountPoint"]
|
||||||
transform = Transform( -1, 0, -8.74227e-08, 0, 1, 0, 8.74227e-08, 0, -1, 2.38419e-07, 0, 0 )
|
transform = Transform( -1, 0, -8.74227e-08, 0, 1, 0, 8.74227e-08, 0, -1, 2.38419e-07, 0, 0 )
|
||||||
|
|
Loading…
Reference in New Issue