mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 13:18:38 +02:00
more clean up of Rig::computeAvatarBoundingCapsule
This commit is contained in:
parent
237872e477
commit
aba164b26e
1 changed files with 4 additions and 6 deletions
|
@ -1704,9 +1704,6 @@ void Rig::computeAvatarBoundingCapsule(
|
||||||
ikNode.setTargetVars("RightFoot", "rightFootPosition", "rightFootRotation",
|
ikNode.setTargetVars("RightFoot", "rightFootPosition", "rightFootRotation",
|
||||||
"rightFootType", "rightFootWeight", 1.0f, {},
|
"rightFootType", "rightFootWeight", 1.0f, {},
|
||||||
QString(), QString(), QString());
|
QString(), QString(), QString());
|
||||||
|
|
||||||
AnimPose geometryToRig = _modelOffset * _geometryOffset;
|
|
||||||
|
|
||||||
glm::vec3 hipsPosition(0.0f);
|
glm::vec3 hipsPosition(0.0f);
|
||||||
int hipsIndex = indexOfJoint("Hips");
|
int hipsIndex = indexOfJoint("Hips");
|
||||||
if (hipsIndex >= 0) {
|
if (hipsIndex >= 0) {
|
||||||
|
@ -1771,14 +1768,15 @@ void Rig::computeAvatarBoundingCapsule(
|
||||||
|
|
||||||
// compute bounding shape parameters
|
// compute bounding shape parameters
|
||||||
// NOTE: we assume that the longest side of totalExtents is the yAxis...
|
// NOTE: we assume that the longest side of totalExtents is the yAxis...
|
||||||
glm::vec3 diagonal = (geometryToRig * totalExtents.maximum) - (geometryToRig * totalExtents.minimum);
|
glm::vec3 diagonal = (transformPoint(_geometryToRigTransform, totalExtents.maximum) -
|
||||||
|
transformPoint(_geometryToRigTransform, totalExtents.minimum));
|
||||||
// ... and assume the radiusOut is half the RMS of the X and Z sides:
|
// ... and assume the radiusOut is half the RMS of the X and Z sides:
|
||||||
radiusOut = 0.5f * sqrtf(0.5f * (diagonal.x * diagonal.x + diagonal.z * diagonal.z));
|
radiusOut = 0.5f * sqrtf(0.5f * (diagonal.x * diagonal.x + diagonal.z * diagonal.z));
|
||||||
heightOut = diagonal.y - 2.0f * radiusOut;
|
heightOut = diagonal.y - 2.0f * radiusOut;
|
||||||
|
|
||||||
glm::vec3 rootPosition = finalPoses[geometry.rootJointIndex].trans();
|
glm::vec3 rootPosition = finalPoses[geometry.rootJointIndex].trans();
|
||||||
glm::vec3 rigCenter = (geometryToRig * (0.5f * (totalExtents.maximum + totalExtents.minimum)));
|
glm::vec3 rigCenter = transformPoint(_geometryToRigTransform, (0.5f * (totalExtents.maximum + totalExtents.minimum)));
|
||||||
localOffsetOut = rigCenter - (geometryToRig * rootPosition);
|
localOffsetOut = rigCenter - transformPoint(_geometryToRigTransform, rootPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Rig::transitionHandPose(float deltaTime, float totalDuration, AnimPose& controlledHandPose, bool isLeftHand,
|
bool Rig::transitionHandPose(float deltaTime, float totalDuration, AnimPose& controlledHandPose, bool isLeftHand,
|
||||||
|
|
Loading…
Reference in a new issue