From 005c5e63711e92677547ec2477238fd1f016fb30 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Tue, 23 Sep 2008 20:07:15 +0000 Subject: BGE bug #17657 fixed: dRotY doesn't work properly after 90 degrees rotation. This problem is caused by discontinuities in the conversion orientation matrix -> euler angles: the angle sign can switch and thus the direction of the rotation produced by the dRot Ipo. To avoid this bug, the matrix->euler conversion must be avoided during the game. I took the following approach that is compatible with Blender (identical effect in the game and in the 3D view): - no change in Add mode: Rot and dRot are treated as additional rotation to the orientation at the start of the Ipo. There is no matrix->euler conversion and thus no discontinuities. - Rot Ipo are treated as absolute rotation. All 3 axis should be specified but if they are not, the startup object orientation will be used to set the unspecified axis. By doing a matrix-> euler conversion once at the start, the discontinuities are avoided. If there are also dRot curves, they are treated as delta of the corresponding Rot curve or startup angle. - dRot Ipo are treated as Add mode in Local axis. Note about Add mode: Rot and dRot curves are treated identically during the game. However, only dRot curves make sense because they don't interfere with the object orientation in the 3D view. --- source/gameengine/Ketsji/KX_IPO_SGController.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source/gameengine/Ketsji/KX_IPO_SGController.h') diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h index 0bd8980f11c..031b74294ce 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.h +++ b/source/gameengine/Ketsji/KX_IPO_SGController.h @@ -72,6 +72,12 @@ class KX_IpoSGController : public SG_Controller /** if IPO initial position has been set for local normal IPO */ bool m_ipo_start_initialized; + /** Euler angles at the start of the game, needed for incomplete ROT Ipo curves */ + class MT_Vector3 m_ipo_start_euler; + + /** true is m_ipo_start_euler has been initialized */ + bool m_ipo_euler_initialized; + /** A reference to the original game object. */ class KX_GameObject* m_game_object; -- cgit v1.2.3