# Weird Collisions in ODE

I'm trying to get a basic OBB/OBB Collision System working. For this I use ODE.

My problem is: Whenever I use the dSpaceCollide and pass in my Space and my Callback, my Callback shows me, that a collision happened. But the contact-point is far away (or even in X/Y/Z-(Near-)Infinite) from my OBB's.

Here a pic:

I did this:

• In the Constructor: Box with dCreateBox
• Every frame: Position with dGeomSetPosition and
• Rotation with dGeomSetRotation
• Also every frame: Check per dSpaceCollide

What could I've missed? Thanks in advance!

PS: I'm using DirectX9!

EDIT:

My Collision-Code:

In my Game-Loop:

dSpaceCollide(space, 0, &nearCallback); // space is my dSpaceID


My NearCallback:

static void nearCallback(void *data, dGeomID o1, dGeomID o2)

{

dContact contact;

contact.surface.mode = dContactBounce | dContactSoftCFM;
contact.surface.mu = dInfinity;
contact.surface.mu2 = 0;
contact.surface.bounce = 0.01;
contact.surface.bounce_vel = 0.1;
contact.surface.soft_cfm = 0.01;

if (int numc = dCollide(o1, o2, 1, &contact.geom, sizeof(dContact)))
{
// DrawTextOnScreen is a function to Draw things on my Screen (obviously)
DrawTextOnScreen("Collision", D3DCOLOR_XRGB(0, 255, 0), 2, 200, 270, 20);
DrawTextOnScreen(std::to_string(numc).c_str(), D3DCOLOR_XRGB(0, 0, 0), 2, 220, 270, 20);
// etc...
}

else
DrawTextOnScreen("No Collision", D3DCOLOR_XRGB(255, 0, 0), 2, 200, 270, 20);
}


EDIT-2:

After some trying I got to a point where the Collision not not works. :-P

I changed it this way:

The Rotation is made by Quaternions instead of Matrices. And I update the Box-Length every Frame.

Now it showes me, that there is no collision when there is no collision. (Fine) The problem is, that when there is a collision, it doesn't show it to me:

But (!) when I Spawn myself at the exact same position of the "Enemy", it detects a collision. I can rotate around the X-Axis and the Point where the collision occurs changes. The collision-point is in a weird Position.

The Box in ODE is declared with the same dimensions as I declared for the Box, which is rendered!

EDIT-3

I just want to show you how I define my Space!

// Initialization
dSpaceID space;
space = dSimpleSpaceCreate(space);

// In the Loop
dSpaceCollide(space, 0, &nearCallback);


I really hope, that you can help! And apologise my english, it's kind of shitty! :-)

EDIT-4 After a week of so doing other stuff, I looked back on the problem and found the issue: In the beginning you have to declare

dDouble


dSingle