Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Deathspleen

Tank wont drive between polygons!

This topic is 6299 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

OK heres the current problem. Im writing a tank game where the tank must drive over rolling terrain. The problem is that the tank falls through the polygons when moving from one polygon to a different polygon which is on a different plane (ie driving up a curved slope or over a peak) The tank is correctly detecting which polygon it is on but the problem seems to be when its "next position" vector passes through 2 or more polygons. The current solution should be to calculate the and average the two colliosn points on both polys and then feed that position back into the collision algorithm as the new end point of the ray. But this still doesnt work and i feel there must be a slightly m ore elegant solution. Any ideas anyone???

Share this post


Link to post
Share on other sites
Advertisement
Could be one of two possible solutions here, depending on how your terrain is organised.

If your terrain data is a heightfield, you just need to get the current polygon in the horizontal plane that contains your tank position. You can then calulate the height of the polygon at that point and blip your tank to that height.

If it''s not a heightfield, you need to calculate the first intersection between the tank''s old position and new position. You set the tank''s new position to be the intersection position, and bounce the tank''s velocity in the collision normal. (You should then move the rest of the timestep with the new velocity to avoid sticking).

Mike.

Share this post


Link to post
Share on other sites

  • 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!