Sign in to follow this  

3D collision question

Recommended Posts

Hello everyone,


Right now I am reading 3D math primer by Fletcher Dunn and Ian Parberry and looking at their AABB3 class (around page 304).


The way they choose to represent their AABB3 class is with:


Vec3 min,

Vec3 max


Note there's no position


To move the verts of the  AABB around, they use a 4x3 matrix which means that the AABB resides exclusively in local space.


However, the collision tests for the AABB class such as


bool AABB3::intersectSphere(const Vec3& center, float radius)const    and

bool AABB3::intersectAABB(args...)


in the implemention detail all appear to be in local space.


Having come from the 2D realm, where I handled all collisions, including contact points, normals, penetration etc in world space, is it better in 3D to do all this in local space?


Perhaps I am missing something as well (it would not be the first time)






Edited by too_many_stars

Share this post

Link to post
Share on other sites

As long as the other sphere/AABB is in the local space of the first AABB there is no problem in the code.


Contact impulse/force handlers assume the contact points and normals are in the same space. Usually in world space.


Contact points and normals can be transformed to the local space of the shapes before performing position correction iteratively. Each iteration the positions and orientations of the bodies are corrected by some ammount. Of course after this the contact points and normals might have changed so in a next iteration we need to rebuild contact points and normals. However, re-run collision detection each iteration can become pretty expensive. So an efficient method, but not as accurate as the former, is to put contact points in the local space before iterating, and then transform the local contact points and normals using the transforms in the current iteration.

Edited by Irlan Robson

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this