diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-13 00:33:24 +0300 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-03-13 00:33:24 +0300 |
commit | 3444d6612a525b879857c60d49165efb01f77529 (patch) | |
tree | f6ab2fc722b2111fbdecb3b4a76da83ab5bb2e57 /source/gameengine/Ketsji/KX_IPO_SGController.h | |
parent | 8cc341a5a4ab8f6cceaae525d7e896760d5f87b5 (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 'source/gameengine/Ketsji/KX_IPO_SGController.h')
-rw-r--r-- | source/gameengine/Ketsji/KX_IPO_SGController.h | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/source/gameengine/Ketsji/KX_IPO_SGController.h b/source/gameengine/Ketsji/KX_IPO_SGController.h index 3b20f47f5fc..1ebd6900741 100644 --- a/source/gameengine/Ketsji/KX_IPO_SGController.h +++ b/source/gameengine/Ketsji/KX_IPO_SGController.h @@ -38,27 +38,40 @@ #include "KX_IPOTransform.h" #include "KX_IInterpolator.h" +#define KX_MAX_IPO_CHANNELS 19 //note- [0] is not used + class KX_IpoSGController : public SG_Controller { KX_IPOTransform m_ipo_xform; T_InterpolatorList m_interpolators; - /* Why not bools? */ - short m_modify_position : 1; - short m_modify_orientation : 1; - short m_modify_scaling : 1; + + /** Flag for each IPO channel that can be applied to a game object */ + bool m_ipo_channels_active[KX_MAX_IPO_CHANNELS]; /** Interpret the ipo as a force rather than a displacement? */ bool m_ipo_as_force; /** Ipo-as-force acts in local rather than in global coordinates? */ bool m_force_ipo_acts_local; - + /** Were settings altered since the last update? */ bool m_modified; /** Local time of this ipo.*/ double m_ipotime; + /** Location of the object when the IPO is first fired (for local transformations) */ + class MT_Point3 m_ipo_start_point; + + /** Orientation of the object when the IPO is first fired (for local transformations) */ + class MT_Matrix3x3 m_ipo_start_orient; + + /** Scale of the object when the IPO is first fired (for local transformations) */ + class MT_Vector3 m_ipo_start_scale; + + /** if IPO initial position has been set for local normal IPO */ + bool m_ipo_start_initialized; + /** A reference to the original game object. */ class KX_GameObject* m_game_object; @@ -80,16 +93,12 @@ public: /** Set reference to the corresponding game object. */ void SetGameObject(class KX_GameObject*); - void SetModifyPosition(bool modifypos) { - m_modify_position=modifypos; - } - void SetModifyOrientation(bool modifyorient) { - m_modify_orientation=modifyorient; - } - void SetModifyScaling(bool modifyscale) { - m_modify_scaling=modifyscale; + void SetIPOChannelActive(int index, bool value) { + //indexes found in makesdna\DNA_ipo_types.h + m_ipo_channels_active[index] = value; } + KX_IPOTransform& GetIPOTransform() { return m_ipo_xform; @@ -105,3 +114,4 @@ public: #endif //__IPO_SGCONTROLLER_H + |