Rotate bullet pattern to face parent

This commit is contained in:
Marco 2025-07-09 12:00:23 +02:00
commit 7d267c406d
19 changed files with 1325 additions and 1245 deletions

View file

@ -17,6 +17,7 @@ public partial class ShootingPattern3D : AttackPattern
[Export] public int bulletCount = 16;
[Export] public float rotationSpeed = 0f;
[Export] public bool UseParentRotationOffset { get; set; } = false;
[Export] public float _rotationOffset = 0f;
[Export] public float duration = 5f;
[Export] public float spread = 360f;
@ -184,6 +185,12 @@ public partial class ShootingPattern3D : AttackPattern
Vector2 direction = pattern.BulletResource.Direction;
// Rotate with parent rotation
if (pattern.UseParentRotationOffset)
{
direction = direction.Rotated(-ScriptHost.ParentObject.GlobalRotation.Y + Mathf.DegToRad(90));
}
// TODO: Fix player aiming for 3D
if (pattern._targetPlayer && GameController.Instance.PlayerPosition.HasValue)
{