I'm having some difficulties getting the transformed bounding box collision to work. I've seen several code snippets of this nature:
Code: Select all
bool collision(ISceneNode* one, ISceneNode* two)
{
if(one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox())) {
return (one->getTransformedBoundingBox().intersectsWithBox(two->getTransformedBoundingBox()));
}
return false;
}
Code: Select all
if(rocket.meshnode->getTransformedBoundingBox().intersectsWithBox(turbine.windfield->getTransformedBoundingBox()))
{
device->setWindowCaption(L"1");
}
else
{
device->setWindowCaption(L"0");
}
I can see that the bounding box is correct - I have enabled the debug information - however the code does something along the lines of this:
Black: Mesh(bounding box is the same as mesh, its just the code that doesn't work)
Red: Collision detection
Blue: Arrow signifying the rotation
Can anyone tell me why this does not work, and perhaps point me in the direction of the solution?
I would be much obliged.
Have a good day, everyone!