mirror of
https://github.com/lubosz/overte.git
synced 2025-04-19 17:03:43 +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),
|
||||
_rotateAccelerationWithAvatar(rotateAccelerationWithAvatar),
|
||||
_rotateAccelerationWithParent(rotateAccelerationWithParent),
|
||||
_scaleWithParent(scaleWithParent) {
|
||||
_scaleWithParent(scaleWithParent),
|
||||
_speed(speed) {
|
||||
}
|
||||
|
||||
PickParabola ParabolaPick::getMathematicalPick() const {
|
||||
|
@ -39,7 +40,7 @@ PickParabola ParabolaPick::getMathematicalPick() const {
|
|||
velocity = currentParentTransform.transformDirection(velocity);
|
||||
} else {
|
||||
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;
|
||||
if (_rotateAccelerationWithAvatar) {
|
||||
|
|
|
@ -89,6 +89,8 @@ protected:
|
|||
bool _rotateAccelerationWithAvatar;
|
||||
bool _rotateAccelerationWithParent;
|
||||
bool _scaleWithParent;
|
||||
// Cached magnitude of _mathPick.velocity
|
||||
float _speed;
|
||||
};
|
||||
|
||||
#endif // hifi_ParabolaPick_h
|
||||
|
|
Loading…
Reference in a new issue