Map and Camera Hull collision detection.

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Map and Camera Hull collision detection.

Post by BoingBoing »

How would I detect if a BSP map and the Camera's Hull/elipsoid are colliding?

A simple bool is great.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Look at the Collison and LoadIrrFile examples.
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Post by BoingBoing »

LoadIrrFile and Collision both open and render the map, but it never actually detects collision with it.

It instead uses the FPS camera. Which I don't want.

EDIT:
I'm not trying to get it to react on collision, just to see if it intersects with the map.
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

Actually, what you need is not that far off from those examples. You load your scene, create triangle selectors for your geometry, and then run collision detection against the triangles from the selectors. Yo could steal the collision code from the ISceneManager::getCollisionResultPosition().

Travis
BoingBoing
Posts: 18
Joined: Fri Sep 11, 2009 4:31 am

Post by BoingBoing »

So far I have this:

Code: Select all

smgr->getSceneCollisionManager()->getCollisionResultPosition(selector,camera->getPosition()+core::vector3df(0,30,0),core::vector3df(30,50,30),core::vector3df(0,-10,0));
But I'm a bit confused as to where to get the other parameters.
I simply copied a bunch of those from

Code: Select all

		scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
			selector, camera, core::vector3df(30,50,30),
			core::vector3df(0,-10,0),
        	core::vector3df(0,30,0));
		camera->addAnimator(anim);
		anim->drop();
I'm also using the Collision example as a base for testing things out.
Post Reply