Set the movement speed of the camera
Set the movement speed of the camera
How do I set the movement speed of the camera after it's been created?
-
- Posts: 31
- Joined: Fri Apr 21, 2006 12:00 am
- Location: Australia
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.
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.
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.
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.