mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
add JointState::setRotation(rotModelFrame)
This commit is contained in:
parent
212ac13802
commit
f19b562e88
2 changed files with 8 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue