mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 06:44:06 +02:00
Added helper scaling function to Avatar.
This commit is contained in:
parent
fc21f7bbac
commit
8bc9214445
3 changed files with 11 additions and 2 deletions
|
@ -970,6 +970,11 @@ glm::quat Avatar::getJointCombinedRotation(const QString& name) const {
|
|||
return rotation;
|
||||
}
|
||||
|
||||
void Avatar::scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const {
|
||||
//Scale a world space vector as if it was relative to the position
|
||||
positionToScale = _position + _scale * (positionToScale - _position);
|
||||
}
|
||||
|
||||
void Avatar::setFaceModelURL(const QUrl& faceModelURL) {
|
||||
AvatarData::setFaceModelURL(faceModelURL);
|
||||
const QUrl DEFAULT_FACE_MODEL_URL = QUrl::fromLocalFile(Application::resourcesPath() + "meshes/defaultAvatar_head.fst");
|
||||
|
|
|
@ -152,6 +152,10 @@ public:
|
|||
|
||||
glm::vec3 getAcceleration() const { return _acceleration; }
|
||||
glm::vec3 getAngularVelocity() const { return _angularVelocity; }
|
||||
|
||||
/// Scales a world space position vector relative to the avatar position and scale
|
||||
/// \param vector position to be scaled. Will store the result
|
||||
void scaleVectorRelativeToPosition(glm::vec3 &positionToScale) const;
|
||||
|
||||
public slots:
|
||||
void updateCollisionGroups();
|
||||
|
|
|
@ -170,8 +170,8 @@ void Hand::renderHandTargets(bool isMine) {
|
|||
glm::vec3 root = palm.getPosition();
|
||||
|
||||
//Scale the positions based on avatar scale
|
||||
tip = myAvatar->getPosition() + avatarScale * (tip - myAvatar->getPosition());
|
||||
root = myAvatar->getPosition() + avatarScale * (root - myAvatar->getPosition());
|
||||
myAvatar->scaleVectorRelativeToPosition(tip);
|
||||
myAvatar->scaleVectorRelativeToPosition(root);
|
||||
|
||||
Avatar::renderJointConnectingCone(root, tip, PALM_FINGER_ROD_RADIUS, PALM_FINGER_ROD_RADIUS);
|
||||
// Render sphere at palm/finger root
|
||||
|
|
Loading…
Reference in a new issue