diff options
author | Benoit Bolsee <benoit.bolsee@online.be> | 2008-05-15 00:22:57 +0400 |
---|---|---|
committer | Benoit Bolsee <benoit.bolsee@online.be> | 2008-05-15 00:22:57 +0400 |
commit | a6a4b78417c3f6c74ccba6379365e16d165e2dc5 (patch) | |
tree | 0f4656d3f2dc1a1ee24f1b2ddbc5667bb44e75a2 /source/gameengine/Ketsji/KX_TrackToActuator.cpp | |
parent | 9f7bc14c572bec936ba5f87c3d7ecc09a852e923 (diff) |
Fix BGE bug #7532: TrackTo Actuator does not work correctly if it has a Vertex Parent. This is only a partial fix: the user must put the parent vertex at the center of the parent object and disable the physics on the tracking object (use empty or collision free object).
Diffstat (limited to 'source/gameengine/Ketsji/KX_TrackToActuator.cpp')
-rw-r--r-- | source/gameengine/Ketsji/KX_TrackToActuator.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/source/gameengine/Ketsji/KX_TrackToActuator.cpp b/source/gameengine/Ketsji/KX_TrackToActuator.cpp index 58b87367258..b9792303565 100644 --- a/source/gameengine/Ketsji/KX_TrackToActuator.cpp +++ b/source/gameengine/Ketsji/KX_TrackToActuator.cpp @@ -69,13 +69,19 @@ KX_TrackToActuator::KX_TrackToActuator(SCA_IObject *gameobj, m_upflag = upflag; m_parentobj = 0; - if (m_object){ + if (m_object) m_object->RegisterActuator(this); - KX_GameObject* curobj = (KX_GameObject*) GetParent(); - m_parentobj = curobj->GetParent(); // check if the object is parented - if (m_parentobj) { // if so, store the initial local rotation - m_parentlocalmat = m_parentobj->GetSGNode()->GetLocalOrientation(); + if (gameobj->isA(&KX_GameObject::Type)) + { + // if the object is vertex parented, don't check parent orientation as the link is broken + if (!((KX_GameObject*)gameobj)->IsVertexParent()){ + m_parentobj = ((KX_GameObject*)gameobj)->GetParent(); // check if the object is parented + if (m_parentobj) { + // if so, store the initial local rotation + // this is needed to revert the effect of the parent inverse node (TBC) + m_parentlocalmat = m_parentobj->GetSGNode()->GetLocalOrientation(); + } } } @@ -180,6 +186,8 @@ KX_TrackToActuator::~KX_TrackToActuator() { if (m_object) m_object->UnregisterActuator(this); + if (m_parentobj) + m_parentobj->Release(); } /* end of destructor */ void KX_TrackToActuator::ProcessReplica() |