Michael IV
Michael IV

Reputation: 11424

Ray AABB intersect test fails when AABB is rotated

I am doing Ray intersection test with AABB.It works fine till I start rotating the AABB contained object.My AABBs by default have normalized coordinated ranging from (-1 , 1) ,so in order to get them into Object's world dimensions I update AABB mins and max transforming those with Object's model matrix.But if the matrix has a rotation on it,the ray test work only when it has the default zero rotation.Does it mean I can't rotate AABB for doing intersect test?

Upvotes: 0

Views: 926

Answers (1)

Jaa-c
Jaa-c

Reputation: 5137

If you rotate AABB with the original model, it's not AABB of that model anymore. What you need to do is compute AABB again after you rotated the object, or you need to use different bounding box, that is not axis aligned (OBB).

See what happens if you rotate AABB together with an object:

enter image description here

Upvotes: 3

Related Questions