Quickstart:
Model Setup:
For each mesh, create a collision model by using:
CollisionModel3D* model = newCollisionModel3D();
(Shared meshes can use one model)
Add all the triangles the mesh has to the model by using:
model->addTriangle(vertex1,vertex2,vertex3);
Call:
model->finalize();
Collision Test:
Assuming you have two models (m1,m2), either set both of their’s transformation
matrices (world matrix) by calling:
m1->setTransform(model1_transformation_matrix);
m2->setTransform(model2_transformation_matrix);
or set only one of them (in case you’re testing the model against itself,
with different
transform) Then call:
m1->collision(m2);
The function returns a bool indicating if a collision has occurred.
Note that if you test a
model against itself with a different transform, you need to supply
that transform as an
optional parameter.
Collision Test Results:
Use the getCollidingTriangles function to get which triangles have collided.
Use the
getCollisionPoint function to find the exact collision point.
Other Collision Tests:
You can use the rayCollision and sphereCollision functions to test the
model against
these primitives.