I have implemented missiles that steer towards a target, however this feels kind of boring.
I want to add loops! Loops are cool! To do this I thought I could use catmull-rom splines, but that seems very static - loops would always end up at the same position unless I made several premade patterns.
Anyone have any other ideas on how I can do this?
I'm using a simple steering function: EDITED
var toTarget = player.Position - missile.Position; toTarget.Normalize(); float turnSpeed = 0.1f; float momentum = 3f; float speed = 1f; currentDirection = Vector2.Lerp(lastDirection, toTarget, turnSpeed); currentDirection.Normalize(); lastDirection = currentDirection; lastPosition = missile.Position; player.Update(gameTime); missile.Update(gameTime); missile.Position = lastPosition + currentDirection * speed + lastDirection * momentum;
I have tried using the player as an attractor object which kind of works - the missile orbits the player object, but it mainly looks like it's moving backwards and forwards while the player object is standing still.