Skip to content

Commit

Permalink
Merge pull request #29 from BerceniSoft/adi/orbit-bug-fix
Browse files Browse the repository at this point in the history
Fix orbit orbit lagging behind player
  • Loading branch information
brown121407 committed Nov 26, 2022
2 parents ba1acde + 5d1a97e commit 519a6b0
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions Assets/Scripts/Projectiles/ProjectileOrbitalController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ private void Start()

private void FixedUpdate()
{
var speed = _shootingQueue.Count > 0 ? orbitShootingSpeed : orbitSpeed;
// // Get all projectiles and rotate them around the parent
foreach (var projectile in _projectiles)
{
projectile.OrbitAround(transform.position, speed);
}

// Move the projectiles along with the player
var playerPos = transform.position;
var deltaPos = playerPos - _prevPlayerPos;
foreach (var projectile in _projectiles)
Expand All @@ -62,6 +54,12 @@ private void FixedUpdate()
}

_prevPlayerPos = playerPos;
var speed = _shootingQueue.Count > 0 ? orbitShootingSpeed : orbitSpeed;
// Get all projectiles and rotate them around the parent
foreach (var projectile in _projectiles)
{
projectile.OrbitAround(playerPos, speed);
}
}

private void Update()
Expand Down

0 comments on commit 519a6b0

Please sign in to comment.