if(Ms.b(1))
{
desired_camera.yaw =Lerp(camYaw, -PI_4,Time.d());
desired_camera.pitch=Lerp(camPitch, -PI_4/2,Time.d());
} else
{
desired_camera.yaw = Players[0].angle.x;
desired_camera.pitch = Players[0].angle.y;
}
Clamp(desired_camera.pitch,-PI_2,PI_2);
camYaw =desired_camera.yaw ;
camPitch=desired_camera.pitch;
OrientP &head=Players[0].cskel.getPoint("head"); // obtain player "head" skeleton point (this was created in Mesh Editor)
Ball ball(0.001f, desired_camera.at);
Physics.move(ball, desired_camera.matrix.pos-ball.pos);
if(camPitch > 0.1f)
{
camPitchInterp = LerpAngle(camPitchInterp, camPitch/2.0f,Time.d()*3);
camUpInterp = Lerp(camUpInterp, camPitch,Time.d()*3);
desired_camera.setSpherical(head.pos,desired_camera.yaw,desired_camera.pitch,0,1.5);
}
else
{
camPitchInterp = Lerp(camPitchInterp, camPitch/4,Time.d()*3);
camUpInterp = Lerp(camUpInterp, camPitch,Time.d()*3);
desired_camera.setSpherical(head.pos,desired_camera.yaw,desired_camera.pitch,0,1.5);
}
Cam.setPosDir(desired_camera.matrix.pos+Vec(0,camPitchInterp,0), desired_camera.matrix.z, desired_camera.matrix.y);