[BloodyMess] Bounding Spheres for Collision

Rydinare

06-05-2009 06:02:35

Hi again, all.

So, I have some code to do collision detection between objects. When I use bounding box, it seems to work, but if I use bounding sphere, I'm getting no collisions. Here's a snippet:


Ogre::Real entitySize = pEntity->getBoundingRadius();

...

OGRE3DBody* pBody = pRenderSystem_->createBody(new NxOgre::Sphere(entitySize),
fromVector3(p_position), p_meshName);


However, this seems to work:


Ogre::Vector3 entitySize = pEntity->getBoundingBox().getSize();

...

OGRE3DBody* pBody = pRenderSystem_->createBody(new NxOgre::Box(entitySize.x, entitySize.y, entitySize.z),
fromVector3(p_position), p_meshName);


Is this not set up correctly or is something else the issue?

Thanks in advance.

betajaen

06-05-2009 09:04:11

It probably is working, but check on the radius of the sphere. You may need to increase it.