Hi,
Yesterday I have programmed my own intersect collision command. I thought you might be interested in it.
This collision has some advantages:
- Works with animated objects (even during animation!, though without bones)
- much faster than dbIntersectObject
- you can call an intersection on indidividual limbs
- you can see and modify the sourcecode
disadvantage:
- slower than sparky
Here's how it works:
First you write:
#include "OpenSourceCollision.h"
...
After you have created an object, you can call it:
OpenSourceCollision::ObjectCollisionClass* ObjectColl;
ObjectColl=new OpenSourceCollision::ObjectCollisionClass(ObjNum);
collision works as follows:
float d=ObjectColl->Intersect(D3DXVECTOR3(x1,y1,z1),D3DXVECTOR3(x2,y2,z2));
You must manually update you object ones per loop by calling:
ObjectColl->Update();
if you want to intersect with individual limbs call
float d=ObjectColl->LimbCollision[LimbNumber]->Intersect(D3DXVECTOR3(x1,y1,z1),D3DXVECTOR3(x2,y2,z2));
You can get the normal vector of the collision point:
D3DXVECTOR3 n=ObjectColl->GetNormal();
Simple, isn't it?
if you add significant improvements please post the updated sourcecode.
Sourcecode and exampleproject attached.
FINAL VERSION RELEASED!!!!