简体   繁体   中英

AndEngine sprite rotation on ground

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM