Page 1 of 1

(Another) Weapon + CameraSceneNodeFPS Problem (Solved)

Posted: Thu Jul 31, 2008 4:25 pm
by almondega
hi, i searched all the weapons + camera topics
half of them is to "search weapons and camera"
another half is to set the weapon as a child of camera

it works for x,y,z translation of the camera

but not for the pitch,yaw and the pointer where the camera is looking at

here is a piece of the code:

Code: Select all

camera = smgr->addCameraSceneNodeFPS(0,100,100,-1,keyMap,9,true,2);
IAnimatedMesh *soldierMesh = smgr->getMesh("Models/Weapons/Pistol/pistol.3ds");
soldierNode = smgr->addAnimatedMeshSceneNode(soldierMesh);
soldierNode->setParent(camera);
somebody know how to rotate the object with the default fps irrlich camera?

tks

Posted: Thu Jul 31, 2008 4:57 pm
by night_hawk
This same problem appeared to my sNow or Never mini-game after the Camera Animators were included in the SVN. I didn't try to fix it nor will I try soon (not a priority), but hope this info should help :P

Posted: Thu Jul 31, 2008 11:00 pm
by almondega
i know how to rotate a 3rd person camera around a character
somebody want to trade this information by a solution to this problem :roll: ?

just kiding x)

Posted: Fri Aug 01, 2008 7:14 am
by JP
Not sure what the problem is.. you're saying your gun doesn't rotate with the camera when you set the camera as the parent? It should do... works fine for me and hundreds of other people :lol:

Maybe show us what you're getting and what you want to achieve?

Posted: Fri Aug 01, 2008 5:11 pm
by almondega
yes, the weapon only fallows the x,y,z of the camera position
when i rotate, the weapon still stopped as is

what i want to do is just a weapon to fallow my camera, not only the camera position, but the rotation too, like any other fps game =]

when i go back home, i'll post the source and the result screen
:?

Posted: Fri Aug 01, 2008 5:43 pm
by Dark_Kilauea
I solved this in my flamethrower demo:

Code: Select all

core::vector3df campos = camera->getAbsolutePosition();

core::vector3df target = camera->getTarget();

core::vector3df view = target - campos;

view.normalize();

//set the rotation of the object to match the "view" vector

//////HERE////////

//This sets the postion
ps->setPosition(camera->getAbsolutePosition() + core::vector3df(0,-15,0) + view.setLength(10));

Posted: Fri Aug 01, 2008 8:04 pm
by almondega
nevermind...
i was testing using the NGE witch uses irr 1.4.0

worked fine in 1.4.1 now (weapon as child of the camera)
-.-

tks guys