Answer the question
In order to leave comments, you need to log in
How to roll a billboard in LibGDX?
A sprite is a decal in 3d space. It is always facing the viewer
motoSpr.lookAt( MyGdxGame.cam.position,MyGdxGame.cam.up);
As soon as I specify after this line motoSpr.setRotationZ(angle) (X,Y are responsible for the rotation towards the camera), so the rotation values to the camera are reset (X,Y included).
For the sake of experiment, I wrote it down like this motoSpr.setRotationZ(motoSpr.getRotation().z); and what do you think? Anyway, the value was reset, and the sprite does not look towards the camera, but by default.
Answer the question
In order to leave comments, you need to log in
Here is the source code on the github
setRotationZ does not rotate only around Z, but specifies a new orientation, which is a rotation around the Z axis.
public void setRotationZ (float angle) {
rotation.set(Vector3.Z, angle);
updated = false;
}
public void rotateZ (float angle) {
rotator.set(Vector3.Z, angle);
rotation.mul(rotator);
updated = false;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question