#### Archived

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

# 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.

## 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 on other sites
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.

1. 1
2. 2
Rutin
24
3. 3
4. 4
JoeJ
18
5. 5

• 14
• 23
• 11
• 11
• 9
• ### Forum Statistics

• Total Topics
631766
• Total Posts
3002233
×