About Store Forum Documentation Contact
Donations:
309$/mo



Post Reply 
Free Camera movement [hint]
Author Message
GeekAntic Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
Masterxilo Offline
Member

Post: #2
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
Visit this user's website Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Free Camera movement [hint]
*0.2*Tm.d()

please check tutorials its all there
12-13-2009 11:44 PM
Find all posts by this user Quote this message in a reply
Post Reply