diff options
author | Stijn Buys <ingar@osirion.org> | 2008-05-10 10:19:16 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-05-10 10:19:16 +0000 |
commit | 930db4020b9af2ccd999cb3a8c980cc9d527f8cf (patch) | |
tree | 1767c67dbe94615c02d529f3ed04e614cb948921 /src/client | |
parent | 421fc71813f08bfe359f9ac7596933a7e4cea6e0 (diff) |
client-side axis interpolation
Diffstat (limited to 'src/client')
-rw-r--r-- | src/client/camera.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/client/camera.cc b/src/client/camera.cc index 573194a..28f60c5 100644 --- a/src/client/camera.cc +++ b/src/client/camera.cc @@ -170,16 +170,16 @@ void draw(float seconds) set_mode(Track); if (core::localcontrol()->state()) { - // client prediction has not been run yet - target = core::localcontrol()->state()->previouslocation() - + (core::localcontrol()->location() - core::localcontrol()->state()->previouslocation()) * core::game()->timeoffset(); + target.assign(core::localcontrol()->state()->location()); + axis.assign(core::localcontrol()->state()->axis()); + } else { + target.assign(core::localcontrol()->location()); + axis.assign(core::localcontrol()->axis()); } - else - target = core::localcontrol()->location(); - + if (mode == Track) { - if (core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->axis().forward(); + if (core::localcontrol()->state() && core::localcontrol()->model()) + target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->state()->axis().forward(); // make the camera swing while turning target_direction = core::localcontrol()->target_direction; @@ -194,21 +194,21 @@ void draw(float seconds) pitch_target = pitch_current - 90 * target_pitch; } else if (mode == Cockpit) { - if (core::localcontrol()->model()) - target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->axis().forward(); + if (core::localcontrol()->state() && core::localcontrol()->model()) + target += core::localcontrol()->model()->maxbbox().x * core::localcontrol()->state()->axis().forward(); } - axis.assign(core::localcontrol()->axis()); + if (mode != Cockpit) { // adjust direction d = degrees180f(yaw_current - yaw_target); - yaw_current = degrees360f( yaw_current - 2* d * seconds); + yaw_current = degrees360f( yaw_current - d * seconds); axis.change_direction(yaw_current); // adjust pitch target d = degrees180f(pitch_current - pitch_target); - pitch_current = degrees360f(pitch_current - 2* d *seconds); + pitch_current = degrees360f(pitch_current - d *seconds); axis.change_pitch(pitch_current); if (core::localcontrol()->model()) |