The code is:
Code: Select all
//avatar test
// need to add a camera and name it camera to use it to
// attach the weapon to it for movement
scene::ICameraSceneNode* camera = smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
// lets place an avatar in the scene
scene::IAnimatedMesh* avMesh = smgr->getMesh("media/defaultblueguy.dmf");
// Create a node so we can attach the avatar to the camera
scene::IAnimatedMeshSceneNode* avNode = smgr->addAnimatedMeshSceneNode( avMesh, camera,
-1 );
// Your animation speed may be different so play with the value
// avNode->setAnimationSpeed(20);
// The next few lines are the ones that have to be hand
// tweaked and you may not at first see your avatar.
// The values below reflect my avatar setting to see
// it in front of me.
avNode->setScale(core::vector3df(6,6,6));
avNode->setPosition(core::vector3df(0,340,50));
avNode->setRotation(core::vector3df(0,-95,0));
// The final setup putting the camera in the level
// where it best suits the start of gameplay.
camera->setPosition(core::vector3df(0,350,50));
camera->setRotation(core::vector3df(0,-95,0));
//Add collision responce to the camera
scene::ISceneNodeAnimator* anim = smgr->createCollisionResponseAnimator(
selector, camera, core::vector3df(30,50,30),
core::vector3df(0,-3,0),
core::vector3df(0,50,0));
camera->addAnimator(anim);
anim->drop();
// disable mouse cursor
device->getCursorControl()->setVisible(false);
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1630
The scene is still rendering fine.
Camera is working as expected with collide and gravity.
No avatar.