Moving character

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
d3nn1as
Posts: 2
Joined: Tue Oct 09, 2007 4:59 pm

Moving character

Post by d3nn1as »

I just looked throught the collision example project.

I need a way to instead of putting the camera on a invisible object, add it to any of the faeries. And move the faerie when I move around. It will be the player model.

I have tried some things, but they all failed :-/

Any help appreciated!

Code: Select all

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

	scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
		selector, camera, core::vector3df(30,50,30),
		core::vector3df(0,-1,0),
		core::vector3df(0,50,0));
	camera->addAnimator(anim);
	anim->drop();
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

irr::scene::ISceneManager::addCameraSceneNode

Code: Select all

virtual ICameraSceneNode* irr::scene::ISceneManager::addCameraSceneNode  	(   	ISceneNode *   	 parent = 0,
		const core::vector3df &  	position = core::vector3df(0, 0, 0),
		const core::vector3df &  	lookat = core::vector3df(0, 0, 100),
		s32  	id = -1
	)

Parameters:
    	parent,: 	Parent scene node of the camera. Can be null. If the parent moves, the camera will move too.
So, pass the scene node to which you want to attach the camera as the first parameter to addCameraSceneNode().
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
bigbear
Posts: 7
Joined: Wed Sep 05, 2007 1:28 am

Post by bigbear »

Please try this code:

Code: Select all

// create triangle selector for the terrain    
    scene::ITriangleSelector* selector
        = smgr->createTerrainTriangleSelector(terrain, 0);
    terrain->setTriangleSelector(selector);
    selector->drop();  

	scene::IAnimatedMeshSceneNode* Character = smgr->addAnimatedMeshSceneNode(smgr->getMesh("media/cat.b3d"));
	
    scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator( 
        selector, Character, core::vector3df(60,100,60),
        core::vector3df(0,-100,0), 
        core::vector3df(0,50,0));
    Character->addAnimator(anim);
    anim->drop();
d3nn1as
Posts: 2
Joined: Tue Oct 09, 2007 4:59 pm

Post by d3nn1as »

I can't get it to work :/

Passing the node as a parameter made so I couldn't move the mouse correctly.
Post Reply