mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Rotate bullet pattern to face parent
This commit is contained in:
parent
ed86ffd184
commit
7d267c406d
19 changed files with 1325 additions and 1245 deletions
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue