问题
By default, the modelInstance is rotated by its centre (0,0,0), I want it to rotate by (0,2,2). I know that in other game engines, there is method like model.setRotationPivot(float)
, is there any similar method in libgdx?
// how to set rotation pivot?
modelInstance.transform.set(position, rotation, scale);
Thanks!
回答1:
Late answer:
As I know there is no method to set the pivot. I use a workaround for this.
Vector3 vec3 = new Vector3(0, 2, 2);
vec3.rotate(Vector3.Y, rotation);
modelInstance.transform.setToTranslation(vec3);
this.transform.rotate(Vector3.Y, rotation);
来源:https://stackoverflow.com/questions/43560838/libgdx-how-to-set-model-rotation-pivot