I am creating a AABB for collision detection. I need to calculate the extents for my model and also update them when my model moves. I calculate my min and max when I create my mesh and I use my position to reference the center.
Could someone please show me how to get the extents either with my min and max vectors or with an array of vertices.
Actually for more clarification I tried this
public Vector3f getMin() {
return Vector3f.sub(pos, extents, null);
}
public Vector3f getMax() {
return Vector3f.add(pos, extents, null);
}
The problem is that everything seems to be centered around the origin(0,0,0). The position is the position of the entity the AABB represents.
extents
? Why is the same method twice there? How is this code not working? Have you tried rendering/printing out the AABB? Are you sure that your min & max positions are calculated correctly? \$\endgroup\$this.extents = Vector3f.sub(max,min,null);
and everything is centered around the origin. \$\endgroup\$