Page 1 of 1

Set the movement speed of the camera

Posted: Thu Jul 27, 2006 12:35 am
by Anteater
How do I set the movement speed of the camera after it's been created?

Posted: Thu Jul 27, 2006 9:22 pm
by Gatekeeper
There's a few posts that people have made about how to move scene nodes independent of frame rate - the same would apply to a camera.

The basic idea is this: If you want to get from A to B in 10 seconds, have a piece of code that each render loop calculates how long it has been since you were at point A (i.e. 5 seconds), and then where you should be if you were travelling between the two points (i.e. halfway between A and B). Then just set the scene nodes position to halfway between A and B.

The movement speed will be determined by how long you want it to take to travel between the two points.

Posted: Fri Jul 28, 2006 9:21 pm
by Anteater
Well, actually, that wasn't what I needed to know. I want to allow the player to run when s/he presses the shift key. I'm using the FPS camera.

Posted: Fri Jul 28, 2006 9:32 pm
by dawasw
And Gatekeeper wrote you the answer.

The FPS camera CANNOT have speed changed dynamically in game because it's speed is declared at creation of camera class. You could change irrlicht's camera class to make speed changer or the fastest way would be as Gatekeeper said it could be rough a bit with FPS camera but it works cause I tested it long time ago (sorry I dont have the sources anymore).

All I can say is to make: camera to move along vector example 10 points in direction of Z axis and make this movement updated by some time. I tried even without timing and it worked too but is was kinda stupid way of doing it without timing.

Posted: Sat Jul 29, 2006 12:30 am
by Spintz
IrrSpintz has the changes to the camera class necessary to adjust the movement speed of the FPS camera( as well as rotation speed )