0
votes

I am developing a game where a body is moved within the scene using touch. The scene has a boundary wall made up of static rectangular bodies. When I move the object along the boundaries it on collision it jitters. This is because the boundary wall pushes the body outwards while the touch pushes it against the wall. I tried to avoid this by setting the linear velocity of the body to 0 on collision with the boundary wall but it didn't work. I am trying to have a smooth movement along the boundary walls with no jitters. Any suggestions?

1

1 Answers

0
votes

Instead of setting the linear velocity, use apply impulse or apply force. If you just set the object velocity, it accelerates instantaneously, causing the jitter. But applying a force to move the object will cancel out when it hits an obstacle and you should end up with the effect you want.