add JointState::setRotation(rotModelFrame)

This commit is contained in:
Andrew Meadows 2014-06-04 14:17:39 -07:00
parent 212ac13802
commit f19b562e88
2 changed files with 8 additions and 3 deletions

View file

@ -1270,9 +1270,7 @@ bool Model::setJointPosition(int jointIndex, const glm::vec3& position, const gl
if (useRotation) {
JointState& state = _jointStates[jointIndex];
// TODO: figure out what this is trying to do and combine it into one JointState method
endRotation = state.getRotation();
state.applyRotationDelta(rotation * glm::inverse(endRotation), true, priority);
state.setRotation(rotation, true, priority);
endRotation = state.getRotation();
}
@ -2033,6 +2031,10 @@ void JointState::clearTransformTranslation() {
_transform[3][2] = 0.0f;
}
void JointState::setRotation(const glm::quat& rotation, bool constrain, float priority) {
applyRotationDelta(rotation * glm::inverse(_rotation), true, priority);
}
void JointState::applyRotationDelta(const glm::quat& delta, bool constrain, float priority) {
// NOTE: delta is in jointParent-frame
assert(_fbxJoint != NULL);

View file

@ -49,6 +49,9 @@ public:
/// \return rotation from bind to model frame
glm::quat getRotationFromBindToModelFrame() const;
/// \param rotation rotation of joint in model-frame
void setRotation(const glm::quat& rotation, bool constrain, float priority);
/// \param delta is in the jointParent-frame
void applyRotationDelta(const glm::quat& delta, bool constrain = true, float priority = 1.0f);