From 71162f9420e078ae4d1eba63a4073ba3844870d6 Mon Sep 17 00:00:00 2001 From: Martin Felis Date: Sat, 11 Nov 2023 10:58:35 +0100 Subject: [PATCH] Minor cleanup. --- components/GroundMotionComponent.cs | 8 ++++---- entities/Tree.tscn | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/components/GroundMotionComponent.cs b/components/GroundMotionComponent.cs index 60024e1..d3d049f 100644 --- a/components/GroundMotionComponent.cs +++ b/components/GroundMotionComponent.cs @@ -37,9 +37,9 @@ public class GroundMotionComponent : Component 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()); planeVelocity -= planeVelocity * Damping; // 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; // 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); if (projectedStep > DistanceToTarget) { @@ -62,7 +62,7 @@ public class GroundMotionComponent : Component // GD.Print(" corr speed: " + planeVelocity.Length() + " step: " + projectedStep); } - var planeSpeed = planeVelocity.Length(); + float planeSpeed = planeVelocity.Length(); if (planeSpeed > MaxSpeed) planeVelocity *= MaxSpeed / planeSpeed; } else diff --git a/entities/Tree.tscn b/entities/Tree.tscn index 1ce9bc3..0b66265 100644 --- a/entities/Tree.tscn +++ b/entities/Tree.tscn @@ -88,6 +88,7 @@ script = ExtResource( 3 ) [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 ) +visible = false [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 )