Hi!
I have a house modell and a desk modell.
I made collision with SceneManager->getSceneCollisionManager()->getSceneNodeFromCameraBB and the collision itself works fine.
My problem is, that I can pick the desk modell through the walls too.
I tried something with masking but it didn't work.
Any idea how to solve this?
Don't pick through walls
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Step 1: Create and set a triangle selector for each scene node. For example:
Step 2a: When you do your collisions checking, loop though all of your scene nodes, and for each one which is touched by your ray (including the house node) transformed into the node's object space, retrieve its triangle selector, and call getCollisionPoint() on it using your ray. The scene node that produces the collision point nearest to your camera/start of your ray is the one that you should select.
Step 2b: Alternatively, download the latest version of Irrlicht, apply this patch, then call getSceneNodeAndCollisionPointFromRay().
Code: Select all
scene::ITriangleSelector* selector = 0;
selector = smgr->createOctTreeTriangleSelector(houseNode->getMesh(0), houseNode, 128);
houseNode->setTriangleSelector(selector);
selector->drop();
selector = smgr->createTriangleSelector(deskNode);
deskNode->setTriangleSelector(selector);
selector->drop();
Step 2b: Alternatively, download the latest version of Irrlicht, apply this patch, then call getSceneNodeAndCollisionPointFromRay().
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way