Hi,
I have a textured Disk
Im trying to rotate the texture around its center … any ideas?
here is my code: the texture is not rotating around the center for some reason :?
private Texture t;
private Matrix3f incr;
public void init(){
incr = new Matrix3f();
TextureState ts = DisplaySystem.getDisplaySystem().getRenderer().createTextureState();
t = TextureManager.loadTexture(
ResourceLocatorTool.locateResource(ResourceLocatorTool.TYPE_TEXTURE, "tex1.jpg"),
Texture.MinificationFilter.Trilinear, Texture.MagnificationFilter.Bilinear);
t.setWrap(Texture.WrapMode.Repeat);
t.setTranslation(new Vector3f());
t.setRotation(new Quaternion());
ts.setTexture(t);
}
public void update(float tpf){
incr.fromAngleNormalAxis(3*tpf, Vector3f.UNIT_Z);
t.getRotation().fromRotationMatrix(
incr.mult(t.getRotation().toRotationMatrix()));
}