Reputation: 4168
He is there a easy way to solve this problem
my sprite rotation is enable , meaning he can spin , but when I'm walking on the ground and the sprite land in 90* or 180 * he walk on the side , or on the head
is there a way to set it when in land the ground to spin it in the angle of the ground?
Thanks
Upvotes: 0
Views: 206
Reputation: 683
You have to use onUpdate method of your physicsWorld. You can also use onUpdate of the player or even contactListener. I can't provide more information because you didn't;)
Then check every frame (thanks onUpdate) what is the ground angle in the place where player stand in the moment (by checking his and ground position). Then you can use rotate method to set Player's rotation equal to ground angle. If you want fluent animation of rotation use
this: registerEntityModifier(new RotationModifier(0.3f, 0, 180))
for Player entity
Upvotes: 1