• 0

C# (XNA) : 3D terrain and movement


Question

Basically I'm a beginner to 3D in C# and I was wondering if anyone knew any decent tutorials about collision with terrain and a model.

If someone wants to take the time to explain how the collision could work that'd be awesome - I'm not sure whether to import a 3D model of the terrain or create it using a height map - will the way collision is detected change depending on which method I chose?

Appreciate the help, hope someone can point me in the right direction.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0
If someone wants to take the time to explain how the collision could work that'd be awesome - I'm not sure whether to import a 3D model of the terrain or create it using a height map - will the way collision is detected change depending on which method I chose?
There's no reason you need to have different code for collision detection.

Basically terrain collision works like any other collision in 3D, you want to approximate your models (characters) using bounding boxes, spheres, etc., and check if they intersect with the terrain: only you can't approximate the terrain with bounding volumes (AFAIK), you test against each vertice in a certain radius around the character.

Of course there's no preventing you from coming up with more custom/optimized solutions, that's all the fun of game programming. I can imagine a system where you would average the terrain height around the character and place him a certain height above that average terrain height; he might interesect with some vertices, but it's probably faster.

See http://www.riemers.net/eng/Tutorials/XNA/Csharp/series1.php for terrain generation using a height map.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.