Jump to content
  • Advertisement
Sign in to follow this  

How to desigh a nagetive missile algorithm?

This topic is 3122 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
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!