turtorial 7, input key, collision didn't work. why

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
ijo coim
Posts: 57
Joined: Fri Mar 25, 2005 1:29 pm
Location: indonesia, jogja-jogja

turtorial 7, input key, collision didn't work. why

Post by ijo coim »

i still confused to make input from user. in turtorial 7, when i add this code :

Code: Select all

SKeyMap keyMap[8];
			keyMap[0].Action = EKA_MOVE_FORWARD;
			keyMap[0].KeyCode = KEY_UP;
			keyMap[1].Action = EKA_MOVE_FORWARD;
			keyMap[1].KeyCode = KEY_KEY_W;
	        
			keyMap[2].Action = EKA_MOVE_BACKWARD;
			keyMap[2].KeyCode = KEY_DOWN;
			keyMap[3].Action = EKA_MOVE_BACKWARD;
			keyMap[3].KeyCode = KEY_KEY_S;
	        
			keyMap[4].Action = EKA_STRAFE_LEFT;
			keyMap[4].KeyCode = KEY_LEFT;
			keyMap[5].Action = EKA_STRAFE_LEFT;
			keyMap[5].KeyCode = KEY_KEY_A;
	        
			keyMap[6].Action = EKA_STRAFE_RIGHT;
			keyMap[6].KeyCode = KEY_RIGHT;
			keyMap[7].Action = EKA_STRAFE_RIGHT;
			keyMap[7].KeyCode = KEY_KEY_D;
	
	q3node = smgr->addCameraSceneNodeFPS(0, 100.0f, 300.0f, -1, keyMap ,8);
collision didn't work. do u know why?

as a matter of fact, i just want to make input key from user, would u give me the code please? and i hope i'll work in turtorial 7.

thanks b4 = terima kasih sebelumnya (in indonesia)

just information, a few days ago, in aceh (tsunami that got more than 90.000 people) there in an earthquake, 8,7 ScaleRichter,(include nias) hope there isn't tsunami any more.

crying for aceh
r3d
Posts: 6
Joined: Mon Mar 28, 2005 1:28 pm

Post by r3d »

First, you need create a scene::IAnimatedMesh, and scene::ISceneNode scene::ITriangleSelector
ej:

scene::IAnimatedMesh* q3levelmesh = smgr->getMesh("20kdm2.bsp");
scene::ISceneNode* q3node = 0;

if (q3levelmesh)
q3node =
smgr->addOctTreeSceneNode(q3levelmesh->getMesh(0));

scene::ITriangleSelector * world;
world = smgr->createOctTreeTriangleSelector(
q3levelmesh->getMesh(0), q3node, 128);
q3node->setTriangleSelector(world);

before you need create a scene::ISceneNodeAnimator ej:

scene::ISceneNodeAnimator* anim =
smgr->createCollisionResponseAnimator(
world, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim); //add collisions ta camera

send me a e-mail r@3d.arg.net.ar Thank's
Post Reply