Fix parabola scaling issues and raypick velocity denormalization due to transform affecting direction scale

This commit is contained in:
sabrina-shanman 2018-09-28 09:27:38 -07:00
parent 411dbbbad3
commit 8f2d3b17d3
2 changed files with 4 additions and 3 deletions

View file

@ -36,9 +36,10 @@ PickParabola ParabolaPick::getMathematicalPick() const {
glm::vec3 position = currentParentTransform.transform(_mathPick.origin);
glm::vec3 velocity = _mathPick.velocity;
if (_scaleWithParent) {
velocity = currentParentTransform.transform(velocity);
} else {
velocity = currentParentTransform.transformDirection(velocity);
} else {
glm::vec3 transformedVelocity = currentParentTransform.transformDirection(velocity);
velocity = glm::normalize(transformedVelocity) * glm::distance(velocity, Vectors::ZERO);
}
glm::vec3 acceleration = _mathPick.acceleration;
if (_rotateAccelerationWithAvatar) {

View file

@ -22,7 +22,7 @@ PickRay RayPick::getMathematicalPick() const {
Transform currentParentTransform = parentTransform->getTransform();
glm::vec3 origin = currentParentTransform.transform(_mathPick.origin);
glm::vec3 direction = currentParentTransform.transformDirection(_mathPick.direction);
glm::vec3 direction = glm::normalize(currentParentTransform.transformDirection(_mathPick.direction));
return PickRay(origin, direction);
}