I'm working on a touch drag feature in OpenGL. Though I got it working, it has a significant jitter while moving. To compensate for the jitter, I tried using smoothdamp to smoothen out the motion of the object
Which although did help with the jitter, it introduced a significant amount of lag/disconnect b/w finger and the object as smooth damp takes a bit of time to get going, as it starts slow, then goes fast and ends slow again.
So I'm thinking is there a way to translate an object along any custom velocity curve? like from here
For Example, say easeOutCirc which has velocity curve equation sqrt(1 - pow(x - 1, 2))
EDIT:
I tried something like this
glm::vec3 easeOutCirc(glm::vec3 curPos, glm::vec3 target, float elapsedTime, float deltaTime)
{
auto dir = target - curPos;
//dir = glm::normalize(dir);
float velocity = sqrt(1 - pow(elapsedTime - 1, 2));
cout << velocity << endl;
return curPos + dir * velocity * deltaTime;
}
This function takes current and target position of the object, elapsed time and delta time.
But it didn't behave like I intended. instead of motion from current position to target, object just jumped around all over the place.