Fix one frame lag controller lag/jitter

Move userInputMapper->update() after inputPlugin->pluginUpdate().
This commit is contained in:
Anthony J. Thibault 2016-03-11 09:28:25 -08:00
parent ab19d3e5a2
commit 5eeb4ca594
5 changed files with 12 additions and 10 deletions

View file

@ -3179,7 +3179,6 @@ void Application::update(float deltaTime) {
auto myAvatar = getMyAvatar();
auto userInputMapper = DependencyManager::get<UserInputMapper>();
userInputMapper->update(deltaTime);
controller::InputCalibrationData calibrationData = {
myAvatar->getSensorToWorldMatrix(),
@ -3197,6 +3196,8 @@ void Application::update(float deltaTime) {
}
}
userInputMapper->update(deltaTime);
_controllerScriptingInterface->updateInputControllers();
// Transfer the user inputs to the driveKeys

View file

@ -1383,9 +1383,6 @@ void MyAvatar::preRender(RenderArgs* renderArgs) {
} else {
DebugDraw::getInstance().removeMarker("rightHandController");
}
// AJT: REMOVE
DebugDraw::getInstance().addMyAvatarMarker("REFERENCE", glm::quat(), glm::vec3(0.0f, 0.7f, -0.5f), glm::vec4(1));
}
DebugDraw::getInstance().updateMyAvatarPos(getPosition());

View file

@ -471,3 +471,11 @@ bool isNaN(glm::quat value) {
return isNaN(value.w) || isNaN(value.x) || isNaN(value.y) || isNaN(value.z);
}
glm::mat4 orthoInverse(const glm::mat4& m) {
glm::mat4 r = m;
r[3] = glm::vec4(0.0f, 0.0f, 0.0f, 1.0f);
r = glm::transpose(r);
r[3] = -(r * m[3]);
r[3][3] = 1.0f;
return r;
}

View file

@ -232,4 +232,6 @@ glm::vec2 getFacingDir2D(const glm::mat4& m);
bool isNaN(glm::vec3 value);
bool isNaN(glm::quat value);
glm::mat4 orthoInverse(const glm::mat4& m);
#endif // hifi_GLMHelpers_h

View file

@ -481,12 +481,6 @@ void SixenseManager::InputDevice::handlePoseEvent(float deltaTime, const control
// transform pose into avatar frame.
auto nextPose = controller::Pose(pos, rot, velocity, angularVelocity).transform(controllerToAvatar);
if (!left) {
// AJT: HACK TO DEBUG IK
nextPose.translation = glm::vec3(0.25f, 0.7f, -0.5f);
nextPose.rotation = glm::quat();
}
if (prevPose.isValid() && (deltaTime > std::numeric_limits<float>::epsilon())) {
nextPose.velocity = (nextPose.getTranslation() - prevPose.getTranslation()) / deltaTime;