improved weapon system and cleaner weapon setup
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 20s
Create tag and build when new code gets to main / Export (push) Successful in 10m20s

This commit is contained in:
2026-01-19 17:25:12 +01:00
parent 4dd48bed70
commit 4224333963
4 changed files with 36 additions and 32 deletions

View File

@@ -184,6 +184,15 @@ public partial class HeadSystem : Node3D
_camera.Fov = Mathf.Lerp(_camera.Fov, targetFov, (float) delta * FovChangeSpeed);
}
public void HideWeapon()
{
_fpRig.Visible = false;
}
public void ShowWeapon()
{
_fpRig.Visible = true;
}
public float ComputeCameraInclineFactor(Vector3 direction)
{
var forward = GetForwardHorizontalVector().Normalized();

View File

@@ -28,6 +28,7 @@ public partial class WeaponSystem : RigidBody3D
private TweenQueueSystem _tweenQueueSystem;
private Transform3D _startTransform;
private Transform3D _startMeshTransform;
private Vector3 _throwDirection;
public Vector3 PlantLocation { get; set; }
@@ -36,7 +37,6 @@ public partial class WeaponSystem : RigidBody3D
public MeshInstance3D WeaponLocationIndicator { get; set; }
public StandardMaterial3D WeaponLocationIndicatorMaterial { get; set; }
public MeshInstance3D WeaponMesh { get; set; }
public StandardMaterial3D WeaponMaterial { get; set; }
public void Init(Node3D head, Camera3D camera)
{
@@ -53,7 +53,7 @@ public partial class WeaponSystem : RigidBody3D
WeaponLocationIndicatorMaterial = WeaponLocationIndicator.GetActiveMaterial(0) as StandardMaterial3D;
WeaponMesh = GetNode<MeshInstance3D>("Weapon");
WeaponMaterial = WeaponMesh.GetActiveMaterial(0) as StandardMaterial3D;
_startMeshTransform = WeaponMesh.Transform;
_tweenQueueSystem = GetNode<TweenQueueSystem>("TweenQueueSystem");
_tweenQueueSystem.Init(this);
@@ -71,16 +71,14 @@ public partial class WeaponSystem : RigidBody3D
public void WeaponLeft()
{
Visible = true;
WeaponLocationIndicator.Visible = true;
WeaponMaterial!.UseFovOverride = false;
// WeaponLocationIndicator.Visible = true;
EmitSignalWeaponThrown();
}
public void WeaponBack()
{
Visible = false;
WeaponLocationIndicator.Visible = false;
WeaponMaterial!.UseFovOverride = true;
// WeaponLocationIndicator.Visible = false;
EmitSignalWeaponRetrieved();
}
@@ -96,7 +94,7 @@ public partial class WeaponSystem : RigidBody3D
{
_weaponState.SendEvent("throw");
WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 1f, 1f);
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 1f, 1f);
_throwDirection = (end - GlobalPosition).Normalized();
PlantLocation = collisionLocation;
@@ -120,10 +118,11 @@ public partial class WeaponSystem : RigidBody3D
{
_weaponState.SendEvent("plant");
WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f);
// WeaponLocationIndicatorMaterial.StencilColor = new Color(1f, 0.2f, 0.2f);
Freeze = true;
GlobalPosition = PlantLocation;
WeaponMesh.Transform = _startMeshTransform;
LookAt(GlobalTransform.Origin + PlantNormal, Vector3.Up, true);
}
@@ -151,11 +150,12 @@ public partial class WeaponSystem : RigidBody3D
}
}
public override void _PhysicsProcess(double _delta)
public override void _Process(double delta)
{
if (!FlyingState.Active) return;
LookAt(GlobalTransform.Origin + LinearVelocity.Normalized(), Vector3.Up, false);
WeaponMesh.Rotation = new Vector3(WeaponMesh.Rotation.X, WeaponMesh.Rotation.Y + (float) delta * 100, WeaponMesh.Rotation.Z);
//LookAt(GlobalTransform.Origin + LinearVelocity.Normalized(), Vector3.Up, false);
}
public bool IsPlantedUnderPlatform()