diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2009-05-18 12:22:51 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2009-05-18 12:22:51 +0400 |
commit | 07fc2aa5268da7708a289fa785b0f0cbd9be2575 (patch) | |
tree | 9bbe540d1853f2a259b64b8d51ad2bf142c3cdda /source/gameengine/Converter/KX_ConvertActuators.cpp | |
parent | 3bda88babfd422e2b40377d8d3be9a4bda7ed997 (diff) |
BGE #18665: Servo control and relative motion
Servo control motion actuator did not work as expected when the object
is moving on a moving platform.
This patch introduces a new Ref field in the servo motion actuator
to set a reference object for the velocity calculation.
You can set the object during the game using the actuator "reference"
attribute; use an object name or an object reference.
The servo controller takes into account the angular velocity of the
reference object to compute the relative local velocity.
Diffstat (limited to 'source/gameengine/Converter/KX_ConvertActuators.cpp')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertActuators.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/gameengine/Converter/KX_ConvertActuators.cpp b/source/gameengine/Converter/KX_ConvertActuators.cpp index 60d64621665..98df34aa4a9 100644 --- a/source/gameengine/Converter/KX_ConvertActuators.cpp +++ b/source/gameengine/Converter/KX_ConvertActuators.cpp @@ -134,6 +134,7 @@ void BL_ConvertActuators(char* maggiename, case ACT_OBJECT: { bObjectActuator* obact = (bObjectActuator*) bact->data; + KX_GameObject* obref = NULL; MT_Vector3 forcevec(KX_BLENDERTRUNC(obact->forceloc[0]), KX_BLENDERTRUNC(obact->forceloc[1]), KX_BLENDERTRUNC(obact->forceloc[2])); @@ -171,9 +172,13 @@ void BL_ConvertActuators(char* maggiename, bitLocalFlag.AngularVelocity = bool((obact->flag & ACT_ANG_VEL_LOCAL)!=0); bitLocalFlag.ServoControl = bool(obact->type == ACT_OBJECT_SERVO); bitLocalFlag.AddOrSetLinV = bool((obact->flag & ACT_ADD_LIN_VEL)!=0); - + if (obact->reference && bitLocalFlag.ServoControl) + { + obref = converter->FindGameObject(obact->reference); + } KX_ObjectActuator* tmpbaseact = new KX_ObjectActuator(gameobj, + obref, forcevec.getValue(), torquevec.getValue(), dlocvec.getValue(), |