Jump to content
  • Advertisement
Sign in to follow this  
Oxyacetylene

Terrain collision with helicopter or missiles

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

I'm writing a simple 3D helicopter game, where a helicopter flies over a terrain. I want the helicopter, and any missiles it fires to collide with the terrain. The collision doesn't have to be massively accurate, as this is a simple arcade style game. All I want is for the helicopter not to go through the terrain, it doesn't even have to bounce off the terrain in the right direction, if it just reversed its velocity, that would be good enough for me. The terrain is composed of chunks, each with their own bounding box, so I don't have to check the helicopter against the whole terrain. Can anyone recommend a good method of doing this? Would it be as simple as checking the helicopter's bounding sphere or bounding box against every terrain triangle I'm a bit confused as to how to implement the collision response. What happens if the helicopter's bounding sphere collides with more than one triangle? Should I just do a ray-triangle intersection between the helicopter's velocity, and all the triangles that the helicopter's bounding volume collides with? What happens if the helicopter is colliding with the terrain and some static object at the same time? Should world collision be seperate from entity/game object collision?

Share this post


Link to post
Share on other sites
Advertisement
If the helicopter isn't going too fast, I would use static sphere-triangle tests for it, else swept sphere-triangle. Collision response will depend on what you want - crash, explode, stop, slide, bounce back, or whatever. For missiles and other projectiles, intersecting a line segment representing the object's velocity with the terrain should be sufficient. For projectile-object intersection, line segment vs. bounding volume intersection would work, or segment vs. mesh if you want to be more accurate.

That's just an overview, of course.

Share this post


Link to post
Share on other sites
Thanks for your response. Yeah, just an overview is fine with me. I'm mainly looking for a sanity check on my ideas for implementing this, so I don't end up wasting time implementing something that can't possibly work.

For the helicopter collision response, I just want it to bounce back off the terrain. The collision doesn't necessarily have to be correct for the triangle's normal, it just has to stop the helicopter from going right through the terrain, and also not look too bad. I'm just a bit confused as to how to manage helicopter collisions if it collides with several different triangles at the same time.

I'm got a pretty clear idea of what I want to do for the object-object collisions, as I can just use bounding volumes, and not have to worry about colliding with several different triangles, it's the terrain collision that's confusing me.

Share this post


Link to post
Share on other sites
Presumably the ground is represented as some sort of heightfield.

So you can make a function which returns the height of the terrain at any given position using linear interpolation or something.

Then you can use that for C/D between these things - pretty accurately if the terrain isn't too hilly.

If you're concerned about more accuracy, do triangle / sphere CD with individual triangles which could be adjacent.

As far as collision response is concerned, if you know approximately the normal of a given bit of terrain, it's a pretty much no-brainer. You can calculate damage based on the speed perpendicular to the surface, or something.

Mark

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!