mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
setJointPositionInModelFrame -> setJointPosition
This commit is contained in:
parent
3af4b1b333
commit
ccfd620c84
3 changed files with 14 additions and 6 deletions
|
@ -136,7 +136,7 @@ void SkeletonModel::applyHandPositionInModelFrame(int jointIndex, const glm::vec
|
||||||
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
if (jointIndex == -1 || jointIndex >= _jointStates.size()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setJointPositionInModelFrame(jointIndex, position, glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
setJointPosition(jointIndex, position, glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
||||||
|
|
||||||
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
const FBXGeometry& geometry = _geometry->getFBXGeometry();
|
||||||
glm::vec3 handPosition, elbowPosition;
|
glm::vec3 handPosition, elbowPosition;
|
||||||
|
@ -194,7 +194,7 @@ void SkeletonModel::applyPalmDataInModelFrame(int jointIndex, PalmData& palm) {
|
||||||
|
|
||||||
} else if (Menu::getInstance()->isOptionChecked(MenuOption::AlignForearmsWithWrists)) {
|
} else if (Menu::getInstance()->isOptionChecked(MenuOption::AlignForearmsWithWrists)) {
|
||||||
glm::vec3 forearmVector = palmRotation * glm::vec3(sign, 0.0f, 0.0f);
|
glm::vec3 forearmVector = palmRotation * glm::vec3(sign, 0.0f, 0.0f);
|
||||||
setJointPositionInModelFrame(parentJointIndex, palmPosition + forearmVector *
|
setJointPosition(parentJointIndex, palmPosition + forearmVector *
|
||||||
geometry.joints.at(jointIndex).distanceToParent * extractUniformScale(_scale),
|
geometry.joints.at(jointIndex).distanceToParent * extractUniformScale(_scale),
|
||||||
glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
glm::quat(), false, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
||||||
JointState& parentState = _jointStates[parentJointIndex];
|
JointState& parentState = _jointStates[parentJointIndex];
|
||||||
|
@ -202,7 +202,7 @@ void SkeletonModel::applyPalmDataInModelFrame(int jointIndex, PalmData& palm) {
|
||||||
// lock hand to forearm by slamming its rotation (in parent-frame) to identity
|
// lock hand to forearm by slamming its rotation (in parent-frame) to identity
|
||||||
_jointStates[jointIndex]._rotationInParentFrame = glm::quat();
|
_jointStates[jointIndex]._rotationInParentFrame = glm::quat();
|
||||||
} else {
|
} else {
|
||||||
setJointPositionInModelFrame(jointIndex, palmPosition, palmRotation,
|
setJointPosition(jointIndex, palmPosition, palmRotation,
|
||||||
true, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
true, -1, false, glm::vec3(0.0f, -1.0f, 0.0f), PALM_PRIORITY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1246,7 +1246,7 @@ void Model::updateJointState(int index) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Model::setJointPositionInModelFrame(int jointIndex, const glm::vec3& position, const glm::quat& rotation, bool useRotation,
|
bool Model::setJointPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation, bool useRotation,
|
||||||
int lastFreeIndex, bool allIntermediatesFree, const glm::vec3& alignment, float priority) {
|
int lastFreeIndex, bool allIntermediatesFree, const glm::vec3& alignment, float priority) {
|
||||||
if (jointIndex == -1 || _jointStates.isEmpty()) {
|
if (jointIndex == -1 || _jointStates.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -1486,7 +1486,7 @@ void Model::applyCollision(CollisionInfo& collision) {
|
||||||
// transform into model-frame
|
// transform into model-frame
|
||||||
glm::vec3 newEnd = glm::inverse(_rotation) * (start + glm::angleAxis(angle, axis) * (end - start) - _translation);
|
glm::vec3 newEnd = glm::inverse(_rotation) * (start + glm::angleAxis(angle, axis) * (end - start) - _translation);
|
||||||
// try to move it
|
// try to move it
|
||||||
setJointPositionInModelFrame(jointIndex, newEnd, glm::quat(), false, -1, true);
|
setJointPosition(jointIndex, newEnd, glm::quat(), false, -1, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -257,7 +257,15 @@ protected:
|
||||||
/// Updates the state of the joint at the specified index.
|
/// Updates the state of the joint at the specified index.
|
||||||
virtual void updateJointState(int index);
|
virtual void updateJointState(int index);
|
||||||
|
|
||||||
bool setJointPositionInModelFrame(int jointIndex, const glm::vec3& translation, const glm::quat& rotation = glm::quat(),
|
/// \param jointIndex index of joint in model structure
|
||||||
|
/// \param position position of joint in model-frame
|
||||||
|
/// \param rotation rotation of joint in model-frame
|
||||||
|
/// \param useRotation false if rotation should be ignored
|
||||||
|
/// \param lastFreeIndex
|
||||||
|
/// \param allIntermediatesFree
|
||||||
|
/// \param alignment
|
||||||
|
/// \return true if joint exists
|
||||||
|
bool setJointPosition(int jointIndex, const glm::vec3& position, const glm::quat& rotation = glm::quat(),
|
||||||
bool useRotation = false, int lastFreeIndex = -1, bool allIntermediatesFree = false,
|
bool useRotation = false, int lastFreeIndex = -1, bool allIntermediatesFree = false,
|
||||||
const glm::vec3& alignment = glm::vec3(0.0f, -1.0f, 0.0f), float priority = 1.0f);
|
const glm::vec3& alignment = glm::vec3(0.0f, -1.0f, 0.0f), float priority = 1.0f);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue