• Advertisement
Sign in to follow this  

Collision detection and walking around environment

This topic is 1374 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, I want to add physics and collision detection in my game. At the moment I'm on the subject 'Collision detection' and I need some suggestions. I use XNACollision.cpp/.h from the Direct3D SDK for intersection tests. I need some help, how should I do to test collision between two AABBs and two spheres? I mean should I transform AABB/Sphere to World Space (but that result's into a fatter box) or should I do collision detection in local space of a object? (there are two boxes of two different models, both have their own local space. Should I transform box0 into local space of box1 and do collision detection there? or should I transform box1 into local space of box0 to do collision detection there?). Should I use physics engine for collision? if yes, then which one and what are the basics for becoming familiar with that physics engine?

 

The last question I put is 'How to walk around environment'? All games have buildings, houses, terrain etc. How they manage to get height of all those objects/environment to walk on it? Should I do ray-casting? (I already have a getHeight(x,z) function in my terrain class but what should I do if a house is on the terrain and I want my player to walk on the stairs and then go to terrace?) 

Edited by newtechnology

Share this post


Link to post
Share on other sites
Advertisement


Should I use physics engine for collision?

Yes !

 


if yes, then which one

This depends on a lot of factors. Most engines already come with a physics engine on board. Physx is popular for AAA titles. I personally prefer bullet (free, eg included in blender). Start with downloading the SDK and play around with some demos.

Share this post


Link to post
Share on other sites

I also suggest you use Bullet, its fast, has a simple API and is pretty easy to set up. Its also free, which may be good if your on a tight budget. Feel free to PM me if you need some help implementing it into your engine/game!

Share this post


Link to post
Share on other sites

Ok I will try to use physics engine but how to walk around environment? ray-casting to get height? or optimized ray-casting (divide mesh into octree to only test nearest triangles.) 

How do professionals do it? (Walking around buildings, floor, stairs, etc.)

Share this post


Link to post
Share on other sites

I think ray-casting is probably the best way to do collision detection with terrain or ground meshes. Bullet has a built-in ray testing function (a member of the btCollisionWorld) that should be quite optimized.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement