GeekAntic
Member
|
Free Camera movement [hint]
Perhaps it is useful for newcomers like me
Code:
void RotateCam() {
Vec rot ( Ms.d.x,-Ms.d.y,0.0f);
Vec mv( 0.0,0.0,Ms.wheel());
Cam.setAngle(Cam.matrix.pos,Cam.yaw - rot.x,Cam.pitch - rot.y);
mv *= Cam.matrix.orn.normalize();
Cam.matrix.move(mv);
Cam.updateVelocities().set();
}
void MoveCam() {
Vec mv( Ms.d.x,Ms.d.y,Ms.wheel()*0.25);
mv *= Cam.matrix.orn.normalize();
Cam.matrix.move(mv);
Cam.updateVelocities().set();
}
|
|
12-10-2009 07:13 PM |
|
Masterxilo
Member
|
RE: Free Camera movement [hint]
Hey, thanks!
I modified it a little bit to use keyboard movement:
Code:
void RotateCam() {
Vec rot ( Ms.d.x,-Ms.d.y,0.0f);
Cam.setAngle(Cam.matrix.pos,Cam.yaw - rot.x,Cam.pitch - rot.y);
Cam.updateVelocities().set();
}
void MoveCam() {
Vec mv(Kb.b(KB_D)*0.2 - Kb.b(KB_A)*0.2,
0,
(1+Kb.b(KB_LSHIFT))*(Kb.b(KB_W)*0.2 - Kb.b(KB_S)*0.2 + Ms.wheel()*2.0));
mv *= Cam.matrix.orn.normalize();
Cam.matrix.move(mv);
Cam.updateVelocities().set();
}
But now the movement values are static so the absolute movement is fps dependent.
Is there some kind of AppSpeed value with which one could multiply movement values to make movements fps independent? (AppSpeed would be, e.g. 1 @ 60FPS, and 2 @ 30 FPS and so on).
Or is there some way to just say the camera to move this fast (in meters per second) and it will be automatically correct/fps independent?
System: Windows 7 Ultimate 64 bit, Q6600 2.4 GHZ, 4GB RAM, nVidia GeForce 260 GTX 896 MB DDR3
Visit my site: hurricane-eye.webs.com
And read my blog: hurricane-eyeent.blogspot.com
|
|
12-13-2009 11:41 PM |
|
Esenthel
Administrator
|
RE: Free Camera movement [hint]
*0.2*Tm.d()
please check tutorials its all there
|
|
12-13-2009 11:44 PM |
|