mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 17:00:13 +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) {
|
if (useRotation) {
|
||||||
JointState& state = _jointStates[jointIndex];
|
JointState& state = _jointStates[jointIndex];
|
||||||
|
|
||||||
// TODO: figure out what this is trying to do and combine it into one JointState method
|
state.setRotation(rotation, true, priority);
|
||||||
endRotation = state.getRotation();
|
|
||||||
state.applyRotationDelta(rotation * glm::inverse(endRotation), true, priority);
|
|
||||||
endRotation = state.getRotation();
|
endRotation = state.getRotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2033,6 +2031,10 @@ void JointState::clearTransformTranslation() {
|
||||||
_transform[3][2] = 0.0f;
|
_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) {
|
void JointState::applyRotationDelta(const glm::quat& delta, bool constrain, float priority) {
|
||||||
// NOTE: delta is in jointParent-frame
|
// NOTE: delta is in jointParent-frame
|
||||||
assert(_fbxJoint != NULL);
|
assert(_fbxJoint != NULL);
|
||||||
|
|
|
@ -49,6 +49,9 @@ public:
|
||||||
/// \return rotation from bind to model frame
|
/// \return rotation from bind to model frame
|
||||||
glm::quat getRotationFromBindToModelFrame() const;
|
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
|
/// \param delta is in the jointParent-frame
|
||||||
void applyRotationDelta(const glm::quat& delta, bool constrain = true, float priority = 1.0f);
|
void applyRotationDelta(const glm::quat& delta, bool constrain = true, float priority = 1.0f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue