FPS Camera Speed Not Scaled When Dynamically Changed

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
kkrizka
Posts: 70
Joined: Sun Sep 30, 2007 3:10 am

FPS Camera Speed Not Scaled When Dynamically Changed

Post by kkrizka »

Hi there,

I am trying to change the move speed of a FPS camera depending on its proximity to another object. Basically as the camera gets closer, it starts to slow down.

Here is how I accomplished it:

Code: Select all

core::list<ISceneNodeAnimator*>::ConstIterator anims=camera[0]->getAnimators().begin();
ISceneNodeAnimatorCameraFPS *anim=(ISceneNodeAnimatorCameraFPS*)*anims;
anim->setMoveSpeed(newCameraSpeed/1000);
Here is the problem that I had:
When I create the FPS camera, the constructor scales the move speed by 1000. However when I change the speed, the scaling does not happen and I have to do it myself. This seems a bit counter-intuitive to me, because I expect the scale of the move speed to be the same no matter from where I set it.

So I'm wondering, is there a reason why changing the speed does not scale the move speed automatically?
Cheers,
Karol Krizka

http://www.krizka.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

I think this is a bug which was "copied" from the old camera to the new animator...
kkrizka
Posts: 70
Joined: Sun Sep 30, 2007 3:10 am

Post by kkrizka »

hybrid wrote:I think this is a bug which was "copied" from the old camera to the new animator...
Alright, should I open a bug report concerning this?

Also I've found another bug. When you remove the event reciever while holding down the one of the arrow keys, it still continues to move even after you let go of the arrow key. The reason for this is that since the animator no longer receives any events, it has no idea that you let go off the button and the array that holds the key presses still have a "true" value. A solution for this is to override the setEventReceiverEnabled function, and if the arguments is "false", then call allKeysUp().
Cheers,
Karol Krizka

http://www.krizka.net
greenya
Posts: 1012
Joined: Sun Jan 21, 2007 1:46 pm
Location: Ukraine
Contact:

Post by greenya »

kkrizka wrote: Also I've found another bug.
I guess you found this: http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=27742

There, rogerborg gives a partial solution -- it really helps with keyboard input (arrow keys), but no help been found with mouse movement: indeed, when you move the mouse and at the same time you do setEventReceiverEnabled(false); then you will not be able to use the mouse because camera takes it to the center of the screen -- all the time, until you do setEventReceiverEnabled(true); and then leave the mouse in piece :).

That is a pity, indeed :(
Post Reply