Jump to content
  • Advertisement
Sign in to follow this  
ownsun

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.

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!