zyzix
Member
|
Camera Speed
Hi Folks,
I'm trying to set the default camera speed, but somehow i'm not getting it. Here's what i do:
camera starts with following values:
Code:
Cam.dist =10;
Cam.yaw =-PI_4;
Cam.pitch=-0.5;
Cam.at.set(2,8,2);
camera-controls:
Code:
// Kamera aktualisieren
{
if(Kb.b(KB_A ))Cam.matrix.pos-=Cam.matrix.x*Tm.d();
if(Kb.b(KB_D ))Cam.matrix.pos+=Cam.matrix.x*Tm.d();
if(Kb.b(KB_W ))Cam.matrix.pos+=Cam.matrix.z*Tm.d();
if(Kb.b(KB_S ))Cam.matrix.pos-=Cam.matrix.z*Tm.d();
if(Kb.b(KB_SPACE))Cam.matrix.pos+=Cam.matrix.y*Tm.d();
if(Kb.b(KB_LCTRL))Cam.matrix.pos-=Cam.matrix.y*Tm.d();
if(Ms.hidden())
{
Cam.yaw -=Ms.dir_d.x;
Cam.pitch+=Ms.dir_d.y;
}
Cam.setAngle(Cam.matrix.pos,Cam.yaw,Cam.pitch).updateVelocities().set();
}
Is there a possibility to set the default Camera Speed ? I've checked the examples and the Doc but nothing found so far. Thanks!
|
|
06-15-2009 01:28 AM |
|
xenno
Member
|
Re: Camera Speed
Well, i'm not a programmer, and my knowledges about maths goes to multiply and so, but i think you could do:
Code:
{
Int speed = 10; //For example
if(Kb.b(KB_A ))Cam.matrix.pos-=Cam.matrix.x*Tm.d() * speed;
if(Kb.b(KB_D ))Cam.matrix.pos+=Cam.matrix.x*Tm.d() * speed;
if(Kb.b(KB_W ))Cam.matrix.pos+=Cam.matrix.z*Tm.d() * speed;
if(Kb.b(KB_S ))Cam.matrix.pos-=Cam.matrix.z*Tm.d() * speed;
if(Kb.b(KB_SPACE))Cam.matrix.pos+=Cam.matrix.y*Tm.d();
if(Kb.b(KB_LCTRL))Cam.matrix.pos-=Cam.matrix.y*Tm.d();
if(Ms.hidden())
{
Cam.yaw -=Ms.dir_d.x;
Cam.pitch+=Ms.dir_d.y;
}
Cam.setAngle(Cam.matrix.pos,Cam.yaw,Cam.pitch).updateVelocities().set();
}
I'm didn't tested, but i think it's ok
PS: And for yaw and pitch, well , do the same xD. I think some one could help you if i didn't.
My PC:
Proccessor: Core2 Quad Q9650
Ram: 4GB
HD: 500 Gb
Video Card: 285GTX 1Gb
Microsoft Windows Vista
|
|
06-15-2009 08:38 AM |
|
zyzix
Member
|
Re: Camera Speed
Worked! Thanks a lot!
|
|
06-15-2009 02:21 PM |
|