mirror of
https://github.com/overte-org/overte.git
synced 2025-04-29 19:42:36 +02:00
Merge pull request #6164 from ZappoMan/exposeMyAvatarHandsToJS
expose MyAvatar.xxxHandPose to JS
This commit is contained in:
commit
a1f14cbf83
3 changed files with 48 additions and 4 deletions
|
@ -596,6 +596,34 @@ glm::vec3 MyAvatar::getRightHandTipPosition() const {
|
||||||
return palmData ? palmData->getTipPosition() : glm::vec3(0.0f);
|
return palmData ? palmData->getTipPosition() : glm::vec3(0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
controller::Pose MyAvatar::getLeftHandPose() const {
|
||||||
|
const int LEFT_HAND = 0;
|
||||||
|
auto palmData = getActivePalm(LEFT_HAND);
|
||||||
|
return palmData ? controller::Pose(palmData->getPosition(), palmData->getRotation(),
|
||||||
|
palmData->getVelocity(), palmData->getRawAngularVelocityAsQuat()) : controller::Pose();
|
||||||
|
}
|
||||||
|
|
||||||
|
controller::Pose MyAvatar::getRightHandPose() const {
|
||||||
|
const int RIGHT_HAND = 1;
|
||||||
|
auto palmData = getActivePalm(RIGHT_HAND);
|
||||||
|
return palmData ? controller::Pose(palmData->getPosition(), palmData->getRotation(),
|
||||||
|
palmData->getVelocity(), palmData->getRawAngularVelocityAsQuat()) : controller::Pose();
|
||||||
|
}
|
||||||
|
|
||||||
|
controller::Pose MyAvatar::getLeftHandTipPose() const {
|
||||||
|
const int LEFT_HAND = 0;
|
||||||
|
auto palmData = getActivePalm(LEFT_HAND);
|
||||||
|
return palmData ? controller::Pose(palmData->getTipPosition(), palmData->getRotation(),
|
||||||
|
palmData->getTipVelocity(), palmData->getRawAngularVelocityAsQuat()) : controller::Pose();
|
||||||
|
}
|
||||||
|
|
||||||
|
controller::Pose MyAvatar::getRightHandTipPose() const {
|
||||||
|
const int RIGHT_HAND = 1;
|
||||||
|
auto palmData = getActivePalm(RIGHT_HAND);
|
||||||
|
return palmData ? controller::Pose(palmData->getTipPosition(), palmData->getRotation(),
|
||||||
|
palmData->getTipVelocity(), palmData->getRawAngularVelocityAsQuat()) : controller::Pose();
|
||||||
|
}
|
||||||
|
|
||||||
// virtual
|
// virtual
|
||||||
void MyAvatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition) {
|
void MyAvatar::render(RenderArgs* renderArgs, const glm::vec3& cameraPosition) {
|
||||||
// don't render if we've been asked to disable local rendering
|
// don't render if we've been asked to disable local rendering
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
#include <DynamicCharacterController.h>
|
#include <DynamicCharacterController.h>
|
||||||
#include <Rig.h>
|
#include <Rig.h>
|
||||||
|
|
||||||
|
#include <controllers/Pose.h>
|
||||||
|
|
||||||
#include "Avatar.h"
|
#include "Avatar.h"
|
||||||
#include "AtRestDetector.h"
|
#include "AtRestDetector.h"
|
||||||
|
|
||||||
|
@ -69,6 +71,11 @@ class MyAvatar : public Avatar {
|
||||||
Q_PROPERTY(glm::vec3 leftHandTipPosition READ getLeftHandTipPosition)
|
Q_PROPERTY(glm::vec3 leftHandTipPosition READ getLeftHandTipPosition)
|
||||||
Q_PROPERTY(glm::vec3 rightHandTipPosition READ getRightHandTipPosition)
|
Q_PROPERTY(glm::vec3 rightHandTipPosition READ getRightHandTipPosition)
|
||||||
|
|
||||||
|
Q_PROPERTY(controller::Pose leftHandPose READ getLeftHandPose)
|
||||||
|
Q_PROPERTY(controller::Pose rightHandPose READ getRightHandPose)
|
||||||
|
Q_PROPERTY(controller::Pose leftHandTipPose READ getLeftHandTipPose)
|
||||||
|
Q_PROPERTY(controller::Pose rightHandTipPose READ getRightHandTipPose)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MyAvatar(RigPointer rig);
|
MyAvatar(RigPointer rig);
|
||||||
~MyAvatar();
|
~MyAvatar();
|
||||||
|
@ -160,6 +167,11 @@ public:
|
||||||
Q_INVOKABLE glm::vec3 getLeftHandTipPosition() const;
|
Q_INVOKABLE glm::vec3 getLeftHandTipPosition() const;
|
||||||
Q_INVOKABLE glm::vec3 getRightHandTipPosition() const;
|
Q_INVOKABLE glm::vec3 getRightHandTipPosition() const;
|
||||||
|
|
||||||
|
Q_INVOKABLE controller::Pose getLeftHandPose() const;
|
||||||
|
Q_INVOKABLE controller::Pose getRightHandPose() const;
|
||||||
|
Q_INVOKABLE controller::Pose getLeftHandTipPose() const;
|
||||||
|
Q_INVOKABLE controller::Pose getRightHandTipPose() const;
|
||||||
|
|
||||||
AvatarWeakPointer getLookAtTargetAvatar() const { return _lookAtTargetAvatar; }
|
AvatarWeakPointer getLookAtTargetAvatar() const { return _lookAtTargetAvatar; }
|
||||||
void updateLookAtTargetAvatar();
|
void updateLookAtTargetAvatar();
|
||||||
void clearLookAtTargetAvatar();
|
void clearLookAtTargetAvatar();
|
||||||
|
|
|
@ -101,8 +101,11 @@ public:
|
||||||
void setRawPosition(const glm::vec3& pos) { _rawPosition = pos; }
|
void setRawPosition(const glm::vec3& pos) { _rawPosition = pos; }
|
||||||
void setRawVelocity(const glm::vec3& velocity) { _rawVelocity = velocity; }
|
void setRawVelocity(const glm::vec3& velocity) { _rawVelocity = velocity; }
|
||||||
const glm::vec3& getRawVelocity() const { return _rawVelocity; }
|
const glm::vec3& getRawVelocity() const { return _rawVelocity; }
|
||||||
|
|
||||||
void setRawAngularVelocity(const glm::vec3& angularVelocity) { _rawAngularVelocity = angularVelocity; }
|
void setRawAngularVelocity(const glm::vec3& angularVelocity) { _rawAngularVelocity = angularVelocity; }
|
||||||
const glm::vec3& getRawAngularVelocity() const { return _rawAngularVelocity; }
|
const glm::vec3& getRawAngularVelocity() const { return _rawAngularVelocity; }
|
||||||
|
glm::quat getRawAngularVelocityAsQuat() const { return glm::quat(_rawAngularVelocity); }
|
||||||
|
|
||||||
void addToPosition(const glm::vec3& delta);
|
void addToPosition(const glm::vec3& delta);
|
||||||
|
|
||||||
void addToPenetration(const glm::vec3& penetration) { _totalPenetration += penetration; }
|
void addToPenetration(const glm::vec3& penetration) { _totalPenetration += penetration; }
|
||||||
|
@ -155,6 +158,7 @@ private:
|
||||||
glm::vec3 _rawPosition;
|
glm::vec3 _rawPosition;
|
||||||
glm::vec3 _rawVelocity;
|
glm::vec3 _rawVelocity;
|
||||||
glm::vec3 _rawAngularVelocity;
|
glm::vec3 _rawAngularVelocity;
|
||||||
|
glm::quat _rawDeltaRotation;
|
||||||
glm::quat _lastRotation;
|
glm::quat _lastRotation;
|
||||||
|
|
||||||
glm::vec3 _tipPosition;
|
glm::vec3 _tipPosition;
|
||||||
|
|
Loading…
Reference in a new issue