mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 04:03:59 +02:00
fix bug: zero velocity when teleporting to new locations
This commit is contained in:
parent
526d998924
commit
bd8fc75305
4 changed files with 20 additions and 3 deletions
|
@ -223,6 +223,20 @@ void Avatar::measureMotionDerivatives(float deltaTime) {
|
|||
_lastOrientation = getOrientation();
|
||||
}
|
||||
|
||||
void Avatar::setPosition(const glm::vec3 position, bool overideReferential) {
|
||||
AvatarData::setPosition(position, overideReferential);
|
||||
_lastPosition = position;
|
||||
_velocity = glm::vec3(0.0f);
|
||||
_lastVelocity = glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
void Avatar::slamPosition(const glm::vec3& newPosition) {
|
||||
_position = newPosition;
|
||||
_lastPosition = newPosition;
|
||||
_velocity = glm::vec3(0.0f);
|
||||
_lastVelocity = glm::vec3(0.0f);
|
||||
}
|
||||
|
||||
void Avatar::setMouseRay(const glm::vec3 &origin, const glm::vec3 &direction) {
|
||||
_mouseRayOrigin = origin;
|
||||
_mouseRayDirection = direction;
|
||||
|
|
|
@ -160,6 +160,9 @@ public:
|
|||
/// 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;
|
||||
|
||||
void setPosition(const glm::vec3 position, bool overideReferential = false);
|
||||
void slamPosition(const glm::vec3& newPosition);
|
||||
|
||||
public slots:
|
||||
void updateCollisionGroups();
|
||||
|
|
|
@ -1767,7 +1767,7 @@ void MyAvatar::maybeUpdateBillboard() {
|
|||
|
||||
void MyAvatar::goHome() {
|
||||
qDebug("Going Home!");
|
||||
setPosition(START_LOCATION);
|
||||
slamPosition(START_LOCATION);
|
||||
}
|
||||
|
||||
void MyAvatar::increaseSize() {
|
||||
|
@ -1827,7 +1827,7 @@ void MyAvatar::goToLocationFromAddress(const QJsonObject& locationObject) {
|
|||
const float DISTANCE_TO_USER = 2.0f;
|
||||
glm::vec3 newPosition = glm::vec3(coordinateItems[0].toFloat(), coordinateItems[1].toFloat(),
|
||||
coordinateItems[2].toFloat()) - newOrientation * IDENTITY_FRONT * DISTANCE_TO_USER;
|
||||
setPosition(newPosition);
|
||||
slamPosition(newPosition);
|
||||
emit transformChanged();
|
||||
}
|
||||
|
||||
|
|
|
@ -145,7 +145,7 @@ public:
|
|||
const QUuid& getSessionUUID() { return _sessionUUID; }
|
||||
|
||||
const glm::vec3& getPosition();
|
||||
void setPosition(const glm::vec3 position, bool overideReferential = false);
|
||||
virtual void setPosition(const glm::vec3 position, bool overideReferential = false);
|
||||
|
||||
glm::vec3 getHandPosition() const;
|
||||
void setHandPosition(const glm::vec3& handPosition);
|
||||
|
|
Loading…
Reference in a new issue