orienting flying sword

This commit is contained in:
2026-01-19 16:55:22 +01:00
parent abe6f42a3b
commit 4dd48bed70
2 changed files with 13 additions and 3 deletions

View File

@@ -276,7 +276,9 @@ PostDashSpeed = 30.0
[node name="WeaponSystem" parent="WeaponRoot" instance=ExtResource("29_wv70j")] [node name="WeaponSystem" parent="WeaponRoot" instance=ExtResource("29_wv70j")]
transform = Transform3D(1, 0, 0, 0, 0.173648, -0.984808, 0, 0.984808, 0.173648, 0.45268, 1.44035, -0.692528) transform = Transform3D(1, 0, 0, 0, 0.173648, -0.984808, 0, 0.984808, 0.173648, 0.45268, 1.44035, -0.692528)
ThrowForce = 15.0 mass = 10.0
gravity_scale = 3.0
ThrowForce = 300.0
StraightThrowDuration = 0.05 StraightThrowDuration = 0.05
[node name="DashIndicator" type="Node3D" parent="."] [node name="DashIndicator" type="Node3D" parent="."]

View File

@@ -70,6 +70,7 @@ public partial class WeaponSystem : RigidBody3D
public void WeaponLeft() public void WeaponLeft()
{ {
Visible = true;
WeaponLocationIndicator.Visible = true; WeaponLocationIndicator.Visible = true;
WeaponMaterial!.UseFovOverride = false; WeaponMaterial!.UseFovOverride = false;
EmitSignalWeaponThrown(); EmitSignalWeaponThrown();
@@ -77,6 +78,7 @@ public partial class WeaponSystem : RigidBody3D
public void WeaponBack() public void WeaponBack()
{ {
Visible = false;
WeaponLocationIndicator.Visible = false; WeaponLocationIndicator.Visible = false;
WeaponMaterial!.UseFovOverride = true; WeaponMaterial!.UseFovOverride = true;
EmitSignalWeaponRetrieved(); EmitSignalWeaponRetrieved();
@@ -88,7 +90,6 @@ public partial class WeaponSystem : RigidBody3D
Freeze = true; Freeze = true;
GlobalPosition = location; GlobalPosition = location;
PlantLocation = location; PlantLocation = location;
Visible = false;
} }
public void ThrowWeapon(Vector3 end, bool hasHit, Vector3 collisionLocation, Vector3 collisionNormal) public void ThrowWeapon(Vector3 end, bool hasHit, Vector3 collisionLocation, Vector3 collisionNormal)
@@ -136,7 +137,7 @@ public partial class WeaponSystem : RigidBody3D
_weaponState.SendEvent("recover"); _weaponState.SendEvent("recover");
Transform = _startTransform; Transform = _startTransform;
Freeze = true; Freeze = true;
Visible = true; Visible = false;
} }
public override void _IntegrateForces(PhysicsDirectBodyState3D state) public override void _IntegrateForces(PhysicsDirectBodyState3D state)
@@ -150,6 +151,13 @@ public partial class WeaponSystem : RigidBody3D
} }
} }
public override void _PhysicsProcess(double _delta)
{
if (!FlyingState.Active) return;
LookAt(GlobalTransform.Origin + LinearVelocity.Normalized(), Vector3.Up, false);
}
public bool IsPlantedUnderPlatform() public bool IsPlantedUnderPlatform()
{ {
return PlantedState.Active && GlobalRotation.X > 1 && Math.Abs(GlobalRotation.Y) > 1; return PlantedState.Active && GlobalRotation.X > 1 && Math.Abs(GlobalRotation.Y) > 1;