Camera Movement

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
Guest

Camera Movement

Post by Guest »

i have loaded my own Q3 level, and now want to add a FPS camera (without going throught the walls, and with gravity). The collision tutorial is confusing me because im not really an experienced programmer.
Im only intrested in the camera movement in the collision tutorial for now. Can some please paste some code for that?
WalterWzK

Post by WalterWzK »

Wich programming language?
Guest

Post by Guest »

Code: Select all

	device->getFileSystem()->addZipFileArchive("../../media/map-20kdm2.pk3");

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

	scene::ITriangleSelector* selector = 0;
	
	if (q3node)
	{		
		q3node->setPosition(core::vector3df(-1370,-130,-1400));

		selector = smgr->createOctTreeTriangleSelector(q3levelmesh->getMesh(0), q3node, 128);
		q3node->setTriangleSelector(selector);
		selector->drop();
	}


	scene::ICameraSceneNode* camera = 
		smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
	camera->setPosition(core::vector3df(-100,50,-150));

	scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
		selector, camera, core::vector3df(30,50,30),
		core::vector3df(0,-100,0), 100.0f, 
		core::vector3df(0,50,0));
	camera->addAnimator(anim);
	anim->drop();
thats the main part :)
Guest

Post by Guest »

this works fine with the map that comes with Irrlicht
but in my level i fall throught the floor forever
im guessing that i start of just below the floor, so please tell me which value to change (im really new to this ) :oops:
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

Post by Spintz »

in the camera->SetPosition ( X, Y, Z ) call, increase the Y value to start out higher
Guest

Post by Guest »

works perfectly
thanks a lot for the help ! :D
AmigaIrr
Posts: 94
Joined: Mon Jan 10, 2005 7:55 am
Location: France, Alsace

Post by AmigaIrr »

how to get the good start position from any map ?

is in the map files a ccord variable ?

how to get this ?
L'eternité c'est long, surtout vers la fin...

Q6600 triton 79, 4 GO, 2* RAPTOR 150GO of ARECA 256 RAID 0, 3870 Zalmann, P5K. 24" Samsung. Antec nine hundred
Post Reply