libgdx-如何设置模型旋转枢轴? [英] libgdx - How to set model rotation pivot?

查看:87
本文介绍了libgdx-如何设置模型旋转枢轴?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,modelInstance以其中心(0,0,0)旋转,我希望它以(0,2,2)旋转.我知道在其他游戏引擎中,有类似model.setRotationPivot(float)的方法,libgdx中有类似的方法吗?

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);

谢谢!

推荐答案

最新答案:

据我所知,没有设置枢轴的方法. 我为此使用了一种解决方法.

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);

这篇关于libgdx-如何设置模型旋转枢轴?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆