(Another) Weapon + CameraSceneNodeFPS Problem (Solved)

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
almondega
Posts: 37
Joined: Sat Jun 21, 2008 2:14 am

(Another) Weapon + CameraSceneNodeFPS Problem (Solved)

Post 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
Last edited by almondega on Fri Aug 01, 2008 8:05 pm, edited 2 times in total.
night_hawk
Posts: 153
Joined: Mon Mar 03, 2008 8:42 am
Location: Suceava - Romania
Contact:

Post 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
almondega
Posts: 37
Joined: Sat Jun 21, 2008 2:14 am

Post 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)
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post 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?
Image Image Image
almondega
Posts: 37
Joined: Sat Jun 21, 2008 2:14 am

Post 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
:?
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post 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));
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
almondega
Posts: 37
Joined: Sat Jun 21, 2008 2:14 am

Post 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
Post Reply