libgdx - How to set model rotation pivot?

拥有回忆 提交于 2019-12-24 08:04:05

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!