libgdx - How to set model rotation pivot?

2019-08-02 21:37发布

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条回答
兄弟一词,经得起流年.
2楼-- · 2019-08-02 21:48

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);
查看更多
登录 后发表回答