diff options
author | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
commit | a8a62201ba762e98dff92cf49033e577fc34d8d4 (patch) | |
tree | 11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/llcharacter/lltargetingmotion.cpp | |
parent | Second Life viewer sources 1.18.6.4-RC (diff) | |
download | meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2 meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz |
Second Life viewer sources 1.19.0.0
Diffstat (limited to 'linden/indra/llcharacter/lltargetingmotion.cpp')
-rw-r--r-- | linden/indra/llcharacter/lltargetingmotion.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/linden/indra/llcharacter/lltargetingmotion.cpp b/linden/indra/llcharacter/lltargetingmotion.cpp index 1676a08..0f160a4 100644 --- a/linden/indra/llcharacter/lltargetingmotion.cpp +++ b/linden/indra/llcharacter/lltargetingmotion.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -55,6 +55,8 @@ LLTargetingMotion::LLTargetingMotion(const LLUUID &id) : LLMotion(id) | |||
55 | { | 55 | { |
56 | mCharacter = NULL; | 56 | mCharacter = NULL; |
57 | mName = "targeting"; | 57 | mName = "targeting"; |
58 | |||
59 | mTorsoState = new LLJointState; | ||
58 | } | 60 | } |
59 | 61 | ||
60 | 62 | ||
@@ -87,11 +89,11 @@ LLMotion::LLMotionInitStatus LLTargetingMotion::onInitialize(LLCharacter *charac | |||
87 | return STATUS_FAILURE; | 89 | return STATUS_FAILURE; |
88 | } | 90 | } |
89 | 91 | ||
90 | mTorsoState.setJoint( mTorsoJoint ); | 92 | mTorsoState->setJoint( mTorsoJoint ); |
91 | 93 | ||
92 | // add joint states to the pose | 94 | // add joint states to the pose |
93 | mTorsoState.setUsage(LLJointState::ROT); | 95 | mTorsoState->setUsage(LLJointState::ROT); |
94 | addJointState( &mTorsoState ); | 96 | addJointState( mTorsoState ); |
95 | 97 | ||
96 | return STATUS_SUCCESS; | 98 | return STATUS_SUCCESS; |
97 | } | 99 | } |
@@ -127,7 +129,7 @@ BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) | |||
127 | } | 129 | } |
128 | 130 | ||
129 | //LLVector3 target_plane_normal = LLVector3(1.f, 0.f, 0.f) * mPelvisJoint->getWorldRotation(); | 131 | //LLVector3 target_plane_normal = LLVector3(1.f, 0.f, 0.f) * mPelvisJoint->getWorldRotation(); |
130 | //LLVector3 torso_dir = LLVector3(1.f, 0.f, 0.f) * (mTorsoJoint->getWorldRotation() * mTorsoState.getRotation()); | 132 | //LLVector3 torso_dir = LLVector3(1.f, 0.f, 0.f) * (mTorsoJoint->getWorldRotation() * mTorsoState->getRotation()); |
131 | 133 | ||
132 | LLVector3 skyward(0.f, 0.f, 1.f); | 134 | LLVector3 skyward(0.f, 0.f, 1.f); |
133 | LLVector3 left(skyward % target); | 135 | LLVector3 left(skyward % target); |
@@ -151,14 +153,14 @@ BOOL LLTargetingMotion::onUpdate(F32 time, U8* joint_mask) | |||
151 | new_torso_rot = new_torso_rot * ~cur_torso_rot; | 153 | new_torso_rot = new_torso_rot * ~cur_torso_rot; |
152 | 154 | ||
153 | // slerp from current additive rotation to ideal additive rotation | 155 | // slerp from current additive rotation to ideal additive rotation |
154 | new_torso_rot = nlerp(slerp_amt, mTorsoState.getRotation(), new_torso_rot); | 156 | new_torso_rot = nlerp(slerp_amt, mTorsoState->getRotation(), new_torso_rot); |
155 | 157 | ||
156 | // constraint overall torso rotation | 158 | // constraint overall torso rotation |
157 | LLQuaternion total_rot = new_torso_rot * mTorsoJoint->getRotation(); | 159 | LLQuaternion total_rot = new_torso_rot * mTorsoJoint->getRotation(); |
158 | total_rot.constrain(F_PI_BY_TWO * 0.8f); | 160 | total_rot.constrain(F_PI_BY_TWO * 0.8f); |
159 | new_torso_rot = total_rot * ~mTorsoJoint->getRotation(); | 161 | new_torso_rot = total_rot * ~mTorsoJoint->getRotation(); |
160 | 162 | ||
161 | mTorsoState.setRotation(new_torso_rot); | 163 | mTorsoState->setRotation(new_torso_rot); |
162 | 164 | ||
163 | return result; | 165 | return result; |
164 | } | 166 | } |