Camera movement Author Message
Harry
Member

 Post: #16 RE: Camera movement How can I change range of rotation angle? Now when camera rotates and gets -PI value it resets to PI and kamera rotates by 360 degrees. http://www.sendspace.com/file/wiu4yn
08-14-2010 04:11 PM
Zervox
Member

 Post: #17 RE: Camera movement I usually use Cos on X vector and sin on Z vector Flt t=Time.time(); Vec(Cos(t),0,(Sin(t)); post your new code if you can, showing the new code makes it easier for other to jump in and help. (This post was last modified: 08-15-2010 08:49 PM by Zervox.)
08-15-2010 08:46 PM
Harry
Member

 Post: #18 RE: Camera movement This is current code: Code: ```if(Ms.b(1))                {                    desired_camera.yaw  -=Ms.dir_d.x;                    desired_camera.pitch+=Ms.dir_d.y;                } else                {                    desired_camera.yaw  =Lerp(camYaw,-Players[0].refCar().matrix().angles().y,Time.d()*2);                    desired_camera.pitch=Lerp(camPitch, -PI_4/2,Time.d());                }                Clamp(desired_camera.pitch,-PI_2,0);                camYaw  =desired_camera.yaw  ;                camPitch=desired_camera.pitch;                desired_camera.setSpherical(Players[0].refCar().matrix().pos,desired_camera.yaw,desired_camera.pitch,0,8);                Ball ball(0.1f, desired_camera.at);                Physics.move(ball, desired_camera.matrix.pos-ball.pos);                Cam.setPosDir(ball.pos, desired_camera.matrix.z, desired_camera.matrix.y); Cam.updateVelocities().set();```
08-16-2010 09:31 AM
Zervox
Member

 Post: #19 RE: Camera movement Code: `desired_camera.yaw =Lerp(-Players[0].refCar().matrix().angles().y,camYaw,Time.d()*2);` Now this is only half fix. When it rotates 360 degrees it gets a slight choke but it doesnt rotate 360 degrees, that or it does it REALLY fast : P (This post was last modified: 08-16-2010 01:41 PM by Zervox.)
08-16-2010 01:41 PM
Harry
Member

 Post: #20 RE: Camera movement This code makes an effect which you can see in a movie which I show few posts ago: http://www.sendspace.com/file/wiu4yn
08-16-2010 03:17 PM
Zervox
Member

 Post: #21 RE: Camera movement did you try the line i posted?, also if you use Time.d()/2 on the line I posted it removes the choking. atleast it works for me, the code you use Code: `desired_camera.yaw  =Lerp(camYaw,-Players[0].refCar().matrix().angles().y,Time.d()*2);` The line I am using is Code: `desired_camera.yaw =Lerp(-Players[0].refCar().matrix().angles().y,camYaw,Time.d()/2);`
08-16-2010 03:26 PM
Harry
Member

 Post: #22 RE: Camera movement When I use your code as you wrote problem is smaller but now I haven't got smooth camera changing between free mode and behind car mode.
08-16-2010 04:00 PM
Zervox
Member

 Post: #23 RE: Camera movement Yeah, I noticed something was changed totally. Try this one Code: `desired_camera.yaw =LerpAngle(Cam.yaw,-Players[0].refCar().matrix().angles().y,Time.d()*5);` (This post was last modified: 08-16-2010 05:12 PM by Zervox.)
08-16-2010 05:09 PM
Harry
Member

 Post: #24 RE: Camera movement Woow I didn't see LerpAngle before xD Thank you very much Zervox
08-16-2010 08:47 PM
Zervox
Member

 Post: #25 RE: Camera movement Hey, no problem, I get some time off and learn things at the same time. Just glad to be able help ^^
08-16-2010 08:53 PM
 « Next Oldest | Next Newest »