java - libGdx how to return the camera rotation -
camera.rotate(1.5f); i can rotate camera degrees so, how can return rotation of current camera example know how many degrees takes can restore normal rotation?
i have dealt same problem , since libgdx camera doesn't natively have function returning rotation, solved creating function returning cameras rotation in degrees.
public float getcamerarotation() { float camangle = -(float)math.atan2(camera.up.x, camera.up.y)*mathutils.radianstodegrees + 180; return camangle; } it works getting camera angle in radiant:
-(float)math.atan2(camera.up.x, camera.up.y) then converting radiant:
*mathutils.radianstodegrees and since range of angle -180 180 converting 0-360
+ 180
Comments
Post a Comment