diff options
author | Stijn Buys <ingar@osirion.org> | 2008-06-14 10:07:12 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-06-14 10:07:12 +0000 |
commit | d9aff6e24a0b0cb650331c77ab724eb8b0109bd6 (patch) | |
tree | 5555759e42258ae05f7363168f1bbf80ecbe5e37 /src/render/camera.cc | |
parent | f1a97c89908be62cdc91c7a3d5b53149aa03de05 (diff) |
fixed potential camera bug for cnontrolable entities without model
Diffstat (limited to 'src/render/camera.cc')
-rw-r--r-- | src/render/camera.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/render/camera.cc b/src/render/camera.cc index 7f1f307..5a6607f 100644 --- a/src/render/camera.cc +++ b/src/render/camera.cc @@ -286,12 +286,18 @@ void Camera::draw(float seconds) camera_axis.change_pitch(pitch_current); } else if (mode() == Cockpit) { + camera_axis.assign(target_axis); - if (core::localcontrol()->state() && core::localcontrol()->model()) - camera_target += (core::localcontrol()->model()->maxbbox().x+0.05) * - core::localcontrol()->state()->axis().forward(); - + if (core::localcontrol()->state()) { + if (core::localcontrol()->model()) { + camera_target += (core::localcontrol()->model()->maxbbox().x+0.05) * + core::localcontrol()->state()->axis().forward(); + } else { + camera_target += (core::localcontrol()->radius() + 0.05) * + core::localcontrol()->state()->axis().forward(); + } + } distance = 0.0f; } } |