www.jpct.net
jPCT - a 3d engine for Java => Support => Topic started by: AGP on January 21, 2014, 04:35:18 am
-
...so as to animate river water? The following doesn't work, for some reason:
public void moveRiverWater(float deltaTime) {
Matrix matrix = river.getTextureMatrix();
if (matrix == null) {
matrix = new Matrix();
river.setTextureMatrix(matrix);
}
matrix.translate(river.getXAxis().x*100*deltaTime, river.getXAxis().y*100*deltaTime, river.getXAxis().z*100f*deltaTime);
river.setTextureMatrix(matrix);//WITH OR WITHOUT THIS SEEMINGLY UNNECESSARY CALL, IT DOESN'T WORK
}
I get absolutely nothing whether or not the object is compiled.
-
You have to keep three things in mind when using a texture matrix:
- It works reliable only on compiled objects.
- It works only on the first texture stage.
- A texture coordinate is usually something between 0..1, maybe 2...and your translation should be accordingly. Not by some magnitude larger.