The AvatarHoldAction now derives the body velocity by using data from the controller::Pose. Rather then trying to derive it based on previous positions. This results in more acurate motion of the held object when the hold is released. OpenVR input plugin: pass the velocity and angularVelocity directly from the controller pose to the controller::Pose.
Showing the changes to interface/src/Application.cpp (1 of 8 files). Show all
Unified · Split
| @@ -5037,6 +5037,8 @@ void Application::setPalmData(Hand* hand, const controller::Pose& pose, float de · 5036 unmodified lines | |||
| 5037 | glm::vec3 position = pose.getTranslation(); | 5037 | glm::vec3 position = pose.getTranslation(); |
| 5038 | glm::quat rotation = pose.getRotation(); | 5038 | glm::quat rotation = pose.getRotation(); |
| 5039 | 5039 | ||
| 5040 | // AJT: REMOVE | ||
| 5041 | /* | ||
| 5040 | // Compute current velocity from position change | 5042 | // Compute current velocity from position change |
| 5041 | glm::vec3 rawVelocity; | 5043 | glm::vec3 rawVelocity; |
| 5042 | if (deltaTime > 0.0f) { | 5044 | if (deltaTime > 0.0f) { |
| @@ -5057,6 +5059,13 @@ void Application::setPalmData(Hand* hand, const controller::Pose& pose, float de · 14 unmodified lines | |||
| 5057 | } else { | 5059 | } else { |
| 5058 | palm.setRawAngularVelocity(glm::vec3(0.0f)); | 5060 | palm.setRawAngularVelocity(glm::vec3(0.0f)); |
| 5059 | } | 5061 | } |
| 5062 | */ | ||
| 5063 | |||
| 5064 | glm::vec3 rawVelocity = pose.getVelocity(); | ||
| 5065 | glm::vec3 angularVelocity = pose.getAngularVelocity(); | ||
| 5066 | |||
| 5067 | palm.setRawVelocity(rawVelocity); | ||
| 5068 | palm.setRawAngularVelocity(angularVelocity); | ||
| 5060 | 5069 | ||
| 5061 | if (controller::InputDevice::getLowVelocityFilter()) { | 5070 | if (controller::InputDevice::getLowVelocityFilter()) { |
| 5062 | // Use a velocity sensitive filter to damp small motions and preserve large ones with | 5071 | // Use a velocity sensitive filter to damp small motions and preserve large ones with |