Don't pick through walls

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
horvim
Posts: 11
Joined: Thu Aug 30, 2007 2:08 pm
Location: Hungary

Don't pick through walls

Post by horvim »

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?
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

Step 1: Create and set a triangle selector for each scene node. For example:

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 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().
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
horvim
Posts: 11
Joined: Thu Aug 30, 2007 2:08 pm
Location: Hungary

Post by horvim »

Latest you mean 1.3.1?
And how to "apply" this patch? Edit manually the .h and .cpp files?
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, latest means SVN development version. Applying a patch works with SVN capable tools such as TortoiseSVN or simple 'patch' from command line.
Umbra
Posts: 19
Joined: Sun Aug 26, 2007 12:54 pm

Post by Umbra »

if you use the camera for col checking this will hapeen in some areas becourse the "char" dont stop until the cam hit the wall same thing that makes it so you can "look" through walls. you can make an object and attatch the cam to it and then use the object for col checking instead.
Post Reply