walls intro my racegame issues

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
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

walls intro my racegame issues

Post by avo18 »

i have a little problem with my walls .
if i drive with my car , i can go through to my walls .

how can i solve that ?
Xharock
Posts: 71
Joined: Wed May 10, 2006 3:50 pm

Post by Xharock »

You need to add in Collision Detection. Check out this tutorial to lear how to do it: http://irrlicht.sourceforge.net/tut007.html
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

i realy cannot find the code .
sgt_pinky
Posts: 149
Joined: Sat Oct 14, 2006 11:20 am
Location: Melbourne, Australia

Post by sgt_pinky »

What do you mean you cannot find the code? Did you do the tutorial that Xharock posted a link to?
Intellectuals solve problems - geniuses prevent them. -- Einstein
#irrlicht on irc.freenode.net
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

yes
Xharock
Posts: 71
Joined: Wed May 10, 2006 3:50 pm

Post by Xharock »

Well first you need to create a Triangle Sleecter for your mesh:

Code: Select all

scene::ITriangleSelector* selector = 0;

selector = smgr->createOctTreeTriangleSelector(levelmesh->getMesh(0), levelnode, 128);
levelnode->setTriangleSelector(selector);
selector->drop();
Then you need to apply a Collision Animator to whatever it is you're controlling; Like a racing car:

Code: Select all

scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(selector, carNode, core::vector3df(30,50,30), core::vector3df(0,-3,0), core::vector3df(0,50,0));

carNode->addAnimator(anim);
anim->drop();
It's all in the tutorial I posted.
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

its dont whont to works .

i've this code

Code: Select all

scene::ITriangleSelector* selector = 0;

scene::ICameraSceneNode* camera = 
		smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, 0, 0, true);
	camera->setPosition(core::vector3df(-200,125,-150)); // die 125 is hoogte van u screenventje 

	scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
		selector, camera, core::vector3df(30,50,30),
		core::vector3df(0,-3,0), 
		core::vector3df(0,90,0));
	camera->addAnimator(anim);
	anim->drop();
device->getCursorControl()->setVisible(false);
  

	//--- licht 
	smgr->addLightSceneNode(0, core::vector3df(-60,100,400),
		video::SColorf(1.0f,1.0f,1.0f,1.0f),
		600.0f);

	//----------------
	scene::ISceneNode* selectedSceneNode = 0;
	scene::ISceneNode* lastSelectedSceneNode = 0;
trooper
Posts: 85
Joined: Fri Nov 03, 2006 7:34 pm
Location: Maryland, USA
Contact:

Post by trooper »

Hi,

As Xharock said above.

Your selector is 0, you havent told it to collide with anything !!

Code: Select all

scene::ITriangleSelector* selector = 0; 

selector = smgr->createOctTreeTriangleSelector(levelmesh->getMesh(0), levelnode, 128); 
levelnode->setTriangleSelector(selector); 
selector->drop();
:wink:
You scratch my back, I'll scratch yours.
avo18
Posts: 27
Joined: Thu Dec 14, 2006 5:46 pm

Post by avo18 »

thanks :D
Post Reply