Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-05-08 02:32:45 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-05-08 02:32:45 +0400
commit44cdc480de4e54a07da751625adc4aa9d67c3f48 (patch)
treeccc0a49ef67afe085997457dcf701d82251db06c /source/gameengine
parent2a8caaa6a0829826b21e83f3ec4734ffb8aa1af9 (diff)
Fix BGE bug #6054: Camera actuator crashes Blender. The crash occurs when min,max << height (bad practice anyway).
Diffstat (limited to 'source/gameengine')
-rw-r--r--source/gameengine/Ketsji/KX_CameraActuator.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/gameengine/Ketsji/KX_CameraActuator.cpp b/source/gameengine/Ketsji/KX_CameraActuator.cpp
index cb3180cb05e..27f4870de10 100644
--- a/source/gameengine/Ketsji/KX_CameraActuator.cpp
+++ b/source/gameengine/Ketsji/KX_CameraActuator.cpp
@@ -155,14 +155,25 @@ static void Kx_VecUpMat3(float *vec, float mat[][3], short axis)
mat[coz][0]= vec[0];
mat[coz][1]= vec[1];
mat[coz][2]= vec[2];
- Kx_Normalize((float *)mat[coz]);
+ if (Kx_Normalize((float *)mat[coz]) == 0.f) {
+ /* this is a very abnormal situation: the camera has reach the object center exactly
+ We will choose a completely arbitrary direction */
+ mat[coz][0] = 1.0f;
+ mat[coz][1] = 0.0f;
+ mat[coz][2] = 0.0f;
+ }
inp= mat[coz][2];
mat[coy][0]= - inp*mat[coz][0];
mat[coy][1]= - inp*mat[coz][1];
mat[coy][2]= 1.0 - inp*mat[coz][2];
- Kx_Normalize((float *)mat[coy]);
+ if (Kx_Normalize((float *)mat[coy]) == 0.f) {
+ /* the camera is vertical, chose the y axis arbitrary */
+ mat[coy][0] = 0.f;
+ mat[coy][1] = 1.f;
+ mat[coy][2] = 0.f;
+ }
Kx_Crossf(mat[cox], mat[coy], mat[coz]);