This property makes it possible to use Newton as a standalone low level collision package that is fully featured, fast and robust.
The part of the collision system exposed to the application is the low level, meaning the application can create any number of collision primitives and just call collision on any primitive pair, and Newton will calculate the contacts, contacts normal and penetration depth for those primitives. These properties together with the ability of Newton to stretch, and or scale any collision primitive along one or more arbitrary axis can be used by an application as the basis for implementing novel high level collision systems like for example swept volumes system without backtracking.
Other features supported by the collision system are:
-Extrapolation of contact calculation based of object velocity
-Closest distance to a point
-Closest distance between convex primitives
-AABB calculation
These features are ideal for applications that already have a dynamics system in place whether it is proprietary physics or another third party dynamics system, but that are having a difficult time with the low level contact calculation of collision primitives or that do not have enough variety collision primitives to play with.
Newton collision system is based on our on proprietary algorithm that does not rely on previous values to calculate new results or existing closest features or GJK implementations, it is also robust mathematically correct and numerically stable.
for example to find out what bodies another body is colliding with, you cna use teh iterators to read the const joints liek this.
- Code: Select all
void GetContactOnBody (NewtonBody* body)
{
for (NewtonJoint* joint = NewtonBodyGetFirstContactJoint (body); joint; joint = NewtonBodyGetNextContactJoint (body, joint)) {
for (void* contact = NewtonContactJointGetFirstContact (joint); contact; contact = NewtonContactJointGetNextContact (joint, contact)) {
float forceMag;
dVector point;
dVector normal;
NewtonBody* body0 = NewtonJointGetBody0(joint);
NewtonBody* body1 = NewtonJointGetBody1(joint);
NewtonMaterial* material = NewtonContactGetMaterial (contact);
//NewtonMaterialGetContactForce (material, &forceMag);
NewtonMaterialGetContactPositionAndNormal (material, &point.m_x, &normal.m_x);
// do whatever you want with the force
}
}
}