Set the movement speed of the camera

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Anteater
Posts: 266
Joined: Thu Jun 01, 2006 4:02 pm
Location: Earth
Contact:

Set the movement speed of the camera

Post by Anteater »

How do I set the movement speed of the camera after it's been created?
Gatekeeper
Posts: 31
Joined: Fri Apr 21, 2006 12:00 am
Location: Australia

Post 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.
Anteater
Posts: 266
Joined: Thu Jun 01, 2006 4:02 pm
Location: Earth
Contact:

Post 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.
dawasw
Posts: 357
Joined: Tue Aug 10, 2004 4:39 pm
Location: Poland

Post 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.
Spintz
Posts: 1688
Joined: Thu Nov 04, 2004 3:25 pm

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