# How to desigh a nagetive missile algorithm?

This topic is 3305 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hey Guys I've written a simple algorithm of missile chasing in 3D space in XNA: public void Update(GameTime gameTime, Vector3 target) { if (Vector3.Distance(Target, Position) != 0.0f) { float time = (float)gameTime.ElapsedGameTime.TotalSeconds; Target = target; //target position Vector3 Distance = Target - Position;//vector between missile and target OffsetDirection = Vector3.Normalize(Distance);//direction vector Vector3 acceleration = OffsetDirection * Force / Mass; //force=400.0f Mass=3.0f Velocity = acceleration * time + Velocity; //Velocity += accerlation * time Position += Velocity * time; Direction = Vector3.Normalize(Velocity); Direction.Normalize(); Right = Vector3.Cross(Direction, Vector3.Forward); Right.Normalize(); Up = Vector3.Cross(Direction, Right); Up.Normalize(); timeCount -= time; Position += Velocity * time; particle.ParticlePositon = Position; particle.Update(gameTime); } else { particle.ParticlePositon = Position; particle.Update(gameTime); } } this is my main thought of the algorithm but anyway I cant get what I real want ! Anybody could tell me why?

##### Share on other sites
You probably want to use a steering behaviour. You'll want the missle to travel with a constant velocity and "turn" towards the target, rather than just applying a constant acceleration towards the target.

1. 1
Rutin
69
2. 2
3. 3
4. 4
5. 5

• 21
• 10
• 33
• 20
• 9
• ### Forum Statistics

• Total Topics
633420
• Total Posts
3011793
• ### Who's Online (See full list)

There are no registered users currently online

×