I have been following tutorial from this link for implementing touchpad in LIBGDX. I want to set the linear velocity for a body using touchpad . I tried updating the position as per this tutorial but the body is not moving smoother.
This is my code for setting up linear velocity,
public void knobinput(float dt)
{
if(touchpad.getKnobPercentX()>0)
{
gamehero.heroBody.setLinearVelocity(1.4f, 0);
}
else
{
gamehero.heroBody.setLinearVelocity(-1.4f, 0);
}
}
When I implement this logic, the body started moving though I didn't give any inputs through touchpad. I want to set the linear velocity as per the above code when the knob is turned right and left but, I didn't know how to check if the knob is turned right or left. Please help. Thanks in advance.