for (int i=0; i<pack.triangles.length; i++){
final float intersection = MouseManager.intersectRayTriangle(camera.getPosition(), mouseray.getDirection(), pack.triangles[i]);
if(intersection != -1) {
System.out.println("Triangle: " + i);
ModelLoader.storeModel(pack.model);
final float[] buffer = new float[]{5};
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, pack.model.getVbos()[0]);
ModelLoader.modBuffer(pack.model.getVbos()[0], i*3*4+4, buffer); //triangle * vertices * byte size + byte skip to get to Y
GL15.glBindBuffer(GL15.GL_ARRAY_BUFFER, 0);
ModelLoader.finalizeModel();
break;
}
}
I am having a problem with this code. It reads, for each triangle, if there is collision, bind the model and its position vbo and modify the position of the triangle so its 5 higher.
I understand that there is a 4 byte offset. I am using GL_FLOAT. This will not work unless I manually count the bytes. I must be doing something wrong.