Rotate ModelInstance at specific point

本小妞迷上赌 提交于 2019-11-28 06:52:28

问题


How can i rotate ModelInstance at specific point( for example center of cube or corner of cube)

ModelInstance inst;

inst.transform.setToTranslation(cone.getX(),cone.getY(),cone.getZ())
        .rotate(Vector3.Y,cone.getTiltOnY()).rotate(Vector3.X,cone.getTiltOnX()).rotate(Vector3.X,90);

In my scenario i trying to rotate cone at its peek , but i rotate it in the middle. How i can set cone at coordinates as above, but rotate it at its peek. I need to do something like that :

 Gdx.gl10.glPushMatrix();
 Gdx.gl10.glTranslatef(x,y,z);
 Gdx.gl10.glRotatef(angle,xaxis,yaxis,zaxis);
 mesh.render();
 Gdx.gl10.glPopMatrix();

But using ModelInstance API of libgdx.

Many thanks!

来源:https://stackoverflow.com/questions/21939393/rotate-modelinstance-at-specific-point

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