summaryrefslogtreecommitdiff
path: root/indra/llcharacter/llheadrotmotion.cpp
diff options
context:
space:
mode:
authorSteve Bennetts <steve@lindenlab.com>2009-11-06 12:20:52 -0800
committerSteve Bennetts <steve@lindenlab.com>2009-11-06 12:20:52 -0800
commit0db73b1ac58650bf681803c93767c64c3d908e15 (patch)
treecba28950adfcf3b8040f1bc7cf449ddab6379b85 /indra/llcharacter/llheadrotmotion.cpp
parent5b5df4769773025978409590e14a807ea2790c84 (diff)
parentafe6350160aa93323a6a5d8ef8c6206bffc337e0 (diff)
merge
Diffstat (limited to 'indra/llcharacter/llheadrotmotion.cpp')
-rw-r--r--indra/llcharacter/llheadrotmotion.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/indra/llcharacter/llheadrotmotion.cpp b/indra/llcharacter/llheadrotmotion.cpp
index 88cd77f7af..0ee378f3b8 100644
--- a/indra/llcharacter/llheadrotmotion.cpp
+++ b/indra/llcharacter/llheadrotmotion.cpp
@@ -251,10 +251,13 @@ BOOL LLHeadRotMotion::onUpdate(F32 time, U8* joint_mask)
mLastHeadRot = head_rot_local;
// Set the head rotation.
- LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld;
- head_rot_local = head_rot_local * ~torsoRotLocal;
- mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) );
- mHeadState->setRotation( nlerp(1.f - NECK_LAG, LLQuaternion::DEFAULT, head_rot_local));
+ if(mNeckState->getJoint() && mNeckState->getJoint()->getParent())
+ {
+ LLQuaternion torsoRotLocal = mNeckState->getJoint()->getParent()->getWorldRotation() * currentInvRootRotWorld;
+ head_rot_local = head_rot_local * ~torsoRotLocal;
+ mNeckState->setRotation( nlerp(NECK_LAG, LLQuaternion::DEFAULT, head_rot_local) );
+ mHeadState->setRotation( nlerp(1.f - NECK_LAG, LLQuaternion::DEFAULT, head_rot_local));
+ }
return TRUE;
}