Sprite Rotation Around Andengine / Java Point

Does anyone know how I can make sprite / bitmap rotate at a certain angle, where a point on one side will always remain in the same position.

enter image description here

I have a blue line in the image, and I need one of the sides to stay in the same position at all times. It would be very helpful if someone could tell me how to do this. I am trying to do this in Andengine / Java. Thus, a solution would be most useful.

thanks

Regards, Yaro

+4
source share
3 answers

AndEngine has a nice method called setRotationCenter. :) By default, the center of rotation is set to the center of the sprite (half width, half height). You can easily change this point.

+2
source

AndEngine is quite limited in terms of rotation and positioning, I ran into a similar problem myself, and the only way to solve it is to redefine methods and extend classes.

I would recommend that you implement a new method that sets the rotation axis and redefines the setRotation () method to use this axis, I think you could figure out how to rotate the sprite on another axis by changing its position, changing its rotation

0
source

I just found a solution to rotate a sprite at any central point. First you create a virtual entity and attach your sprite to this object (note: the position of the sprite relative to your object), then you move the center of rotation of the sprite (by default in the center of the image) to overlap the center of rotation of the object. Final, you set the rotation for the object instead of the sprite. Hope this is useful ^^

0
source

All Articles