mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 11:48:52 +02:00
Store hand position relative to body orientation/position.
This commit is contained in:
parent
520f7a78a8
commit
81ab68a529
5 changed files with 14 additions and 8 deletions
|
@ -124,10 +124,6 @@ glm::vec3 Avatar::getChestPosition() const {
|
||||||
return _skeletonModel.getNeckPosition(neckPosition) ? (_position + neckPosition) * 0.5f : _position;
|
return _skeletonModel.getNeckPosition(neckPosition) ? (_position + neckPosition) * 0.5f : _position;
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::quat Avatar::getOrientation() const {
|
|
||||||
return glm::quat(glm::radians(glm::vec3(_bodyPitch, _bodyYaw, _bodyRoll)));
|
|
||||||
}
|
|
||||||
|
|
||||||
glm::quat Avatar::getWorldAlignedOrientation () const {
|
glm::quat Avatar::getWorldAlignedOrientation () const {
|
||||||
return computeRotationFromBodyToWorldUp() * getOrientation();
|
return computeRotationFromBodyToWorldUp() * getOrientation();
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,7 +92,6 @@ public:
|
||||||
const glm::vec3& getVelocity() const { return _velocity; }
|
const glm::vec3& getVelocity() const { return _velocity; }
|
||||||
Head& getHead() { return _head; }
|
Head& getHead() { return _head; }
|
||||||
Hand& getHand() { return _hand; }
|
Hand& getHand() { return _hand; }
|
||||||
glm::quat getOrientation() const;
|
|
||||||
glm::quat getWorldAlignedOrientation() const;
|
glm::quat getWorldAlignedOrientation() const;
|
||||||
|
|
||||||
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
bool findRayIntersection(const glm::vec3& origin, const glm::vec3& direction, float& distance) const;
|
||||||
|
|
|
@ -44,6 +44,15 @@ AvatarData::~AvatarData() {
|
||||||
delete _handData;
|
delete _handData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec3 AvatarData::getHandPosition() const {
|
||||||
|
return getOrientation() * _handPosition + _position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AvatarData::setHandPosition(const glm::vec3& handPosition) {
|
||||||
|
// store relative to position/orientation
|
||||||
|
_handPosition = glm::inverse(getOrientation()) * (handPosition - _position);
|
||||||
|
}
|
||||||
|
|
||||||
int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
int AvatarData::getBroadcastData(unsigned char* destinationBuffer) {
|
||||||
unsigned char* bufferStart = destinationBuffer;
|
unsigned char* bufferStart = destinationBuffer;
|
||||||
|
|
||||||
|
|
|
@ -76,8 +76,8 @@ public:
|
||||||
const glm::vec3& getPosition() const { return _position; }
|
const glm::vec3& getPosition() const { return _position; }
|
||||||
void setPosition(const glm::vec3 position) { _position = position; }
|
void setPosition(const glm::vec3 position) { _position = position; }
|
||||||
|
|
||||||
const glm::vec3& getHandPosition() const { return _handPosition; }
|
glm::vec3 getHandPosition() const;
|
||||||
void setHandPosition(const glm::vec3 handPosition) { _handPosition = handPosition; }
|
void setHandPosition(const glm::vec3& handPosition);
|
||||||
|
|
||||||
int getBroadcastData(unsigned char* destinationBuffer);
|
int getBroadcastData(unsigned char* destinationBuffer);
|
||||||
int parseData(unsigned char* sourceBuffer, int numBytes);
|
int parseData(unsigned char* sourceBuffer, int numBytes);
|
||||||
|
@ -93,6 +93,8 @@ public:
|
||||||
float getBodyRoll() const { return _bodyRoll; }
|
float getBodyRoll() const { return _bodyRoll; }
|
||||||
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
void setBodyRoll(float bodyRoll) { _bodyRoll = bodyRoll; }
|
||||||
|
|
||||||
|
glm::quat getOrientation() const { return glm::quat(glm::radians(glm::vec3(_bodyPitch, _bodyYaw, _bodyRoll))); }
|
||||||
|
|
||||||
// Scale
|
// Scale
|
||||||
float getTargetScale() const { return _targetScale; }
|
float getTargetScale() const { return _targetScale; }
|
||||||
void setTargetScale(float targetScale) { _targetScale = targetScale; }
|
void setTargetScale(float targetScale) { _targetScale = targetScale; }
|
||||||
|
|
|
@ -20,7 +20,7 @@ PACKET_VERSION versionForPacketType(PACKET_TYPE type) {
|
||||||
return 2;
|
return 2;
|
||||||
|
|
||||||
case PACKET_TYPE_HEAD_DATA:
|
case PACKET_TYPE_HEAD_DATA:
|
||||||
return 14;
|
return 15;
|
||||||
|
|
||||||
case PACKET_TYPE_AVATAR_URLS:
|
case PACKET_TYPE_AVATAR_URLS:
|
||||||
return 2;
|
return 2;
|
||||||
|
|
Loading…
Reference in a new issue