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-03-13 00:33:24 +0300
committerBenoit Bolsee <benoit.bolsee@online.be>2008-03-13 00:33:24 +0300
commit3444d6612a525b879857c60d49165efb01f77529 (patch)
treef6ab2fc722b2111fbdecb3b4a76da83ab5bb2e57 /intern/moto
parent8cc341a5a4ab8f6cceaae525d7e896760d5f87b5 (diff)
Delta Loc/Rot/Scale Ipo curve are now supporting in the BGE with the following limitations:
1. All Ipo channels are now independent. In Blender 2.45, all 3 Loc Ipo channels were automatically set together. For example, having just a LocX Ipo channel was sufficient to fix the X, Y and Z coordinates, with the Y and Z value taken from the object original Y and Z location in Blender. The same was true for the 3 Rot and the 3 Scale Ipo channels: the missing channels were assumed to have constant value taken from the object original orientation/scale in Blender. With this patch, all Ipo channels are now independent. THIS WILL CREATE BACKWARD COMPATIBILITY PROBLEM if you omit to define the 3 channels of a same type together in your Blend file: the undefined Loc, Rot, Scale coordinates of the object will be influenced by the parent/spawner Loc/Rot/Scale in case the object is a child or dynamically created. 2. Delta Loc, Rot, Scale are now supported with the following limitations: - The delta Loc/Rot Ipo modify the object global (NOT local) location/orientation - The delta Scale change the object local scale - The delta Ipo curves are relative to the object starting Loc/Rot/Scale when the Ipo was first activated; after that, the delta Ipo becomes global. This means that the object will return to this initial Loc/Rot/Scale when you later restart the Ipo curve, even if you had changed the object Loc/Rot/Scale in the meantime. Of course this applies only to the specific Loc/Rot/Scale coordinate that are defined in the Ipo channels as the channels are now independent. 3. When the objects are converted from Blender to the BGE, the delta Loc/Rot/Scale that might result from initial non-zero values in delta Ipo Curves will be ignored. However, as soon as the delta Ipo curve is activated, the non-zero values will be taken into account and the object will jump to the same Loc/Rot/Scale situation as in Blender. Note that delta Ipo curves with initial non-zero values is bad practice; logically, a delta Ipo curver should always start from 0. 4. If you define both a global and delta channel of the same type (LocX and DLocX), the result will be a global channel equivalent to the sum of the two channels (LocX+DLocX).
Diffstat (limited to 'intern/moto')
-rw-r--r--intern/moto/include/MT_Matrix3x3.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/intern/moto/include/MT_Matrix3x3.h b/intern/moto/include/MT_Matrix3x3.h
index fb899a7da96..98851e73040 100644
--- a/intern/moto/include/MT_Matrix3x3.h
+++ b/intern/moto/include/MT_Matrix3x3.h
@@ -147,6 +147,26 @@ public:
-sj, cj * si, cj * ci);
}
+ void getEuler(MT_Scalar& yaw, MT_Scalar& pitch, MT_Scalar& roll) const
+ {
+ if (m_el[2][0] != -1.0 && m_el[2][0] != 1.0) {
+ pitch = MT_Scalar(-asin(m_el[2][0]));
+ yaw = MT_Scalar(atan2(m_el[2][1] / cos(pitch), m_el[2][2] / cos(pitch)));
+ roll = MT_Scalar(atan2(m_el[1][0] / cos(pitch), m_el[0][0] / cos(pitch)));
+ }
+ else {
+ roll = MT_Scalar(0);
+ if (m_el[2][0] == -1.0) {
+ pitch = MT_PI / 2.0;
+ yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ }
+ else {
+ pitch = - MT_PI / 2.0;
+ yaw = MT_Scalar(atan2(m_el[0][1], m_el[0][2]));
+ }
+ }
+ }
+
void scale(MT_Scalar x, MT_Scalar y, MT_Scalar z) {
m_el[0][0] *= x; m_el[0][1] *= y; m_el[0][2] *= z;
m_el[1][0] *= x; m_el[1][1] *= y; m_el[1][2] *= z;