mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 21:17:01 +02:00
Cache ParabolaPick speed
This commit is contained in:
parent
b60a62da8f
commit
f3f9976cfb
2 changed files with 5 additions and 2 deletions
|
@ -19,7 +19,8 @@ ParabolaPick::ParabolaPick(const glm::vec3& position, const glm::vec3& direction
|
||||||
Pick(PickParabola(position, speed * direction, accelerationAxis), filter, maxDistance, enabled),
|
Pick(PickParabola(position, speed * direction, accelerationAxis), filter, maxDistance, enabled),
|
||||||
_rotateAccelerationWithAvatar(rotateAccelerationWithAvatar),
|
_rotateAccelerationWithAvatar(rotateAccelerationWithAvatar),
|
||||||
_rotateAccelerationWithParent(rotateAccelerationWithParent),
|
_rotateAccelerationWithParent(rotateAccelerationWithParent),
|
||||||
_scaleWithParent(scaleWithParent) {
|
_scaleWithParent(scaleWithParent),
|
||||||
|
_speed(speed) {
|
||||||
}
|
}
|
||||||
|
|
||||||
PickParabola ParabolaPick::getMathematicalPick() const {
|
PickParabola ParabolaPick::getMathematicalPick() const {
|
||||||
|
@ -39,7 +40,7 @@ PickParabola ParabolaPick::getMathematicalPick() const {
|
||||||
velocity = currentParentTransform.transformDirection(velocity);
|
velocity = currentParentTransform.transformDirection(velocity);
|
||||||
} else {
|
} else {
|
||||||
glm::vec3 transformedVelocity = currentParentTransform.transformDirection(velocity);
|
glm::vec3 transformedVelocity = currentParentTransform.transformDirection(velocity);
|
||||||
velocity = glm::normalize(transformedVelocity) * glm::distance(velocity, Vectors::ZERO);
|
velocity = glm::normalize(transformedVelocity) * _speed;
|
||||||
}
|
}
|
||||||
glm::vec3 acceleration = _mathPick.acceleration;
|
glm::vec3 acceleration = _mathPick.acceleration;
|
||||||
if (_rotateAccelerationWithAvatar) {
|
if (_rotateAccelerationWithAvatar) {
|
||||||
|
|
|
@ -89,6 +89,8 @@ protected:
|
||||||
bool _rotateAccelerationWithAvatar;
|
bool _rotateAccelerationWithAvatar;
|
||||||
bool _rotateAccelerationWithParent;
|
bool _rotateAccelerationWithParent;
|
||||||
bool _scaleWithParent;
|
bool _scaleWithParent;
|
||||||
|
// Cached magnitude of _mathPick.velocity
|
||||||
|
float _speed;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_ParabolaPick_h
|
#endif // hifi_ParabolaPick_h
|
||||||
|
|
Loading…
Reference in a new issue