weird collision effect on debugger

rogermr

31-01-2009 04:29:07

Hi!
I'm trying to set a simple scene here, but I find some weird effects on the debugger and I dont really know why it happens :/

pic:


Here's the code when creating the 3 things

// floor
NxOgre::Body* nxBody = mNxScene->createBody("", new NxOgre::CubeShape(10000,1,10000), Ogre::Vector3(0,0,0) , "static: yes");
// body
NxOgre::Body* mBody = mNxScene->createBody("cube.mesh", new CubeShape(2), Vector3(0,10.0f,0), "Mass: 10");
// character (the top one)
NxOgre::CharacterParams cp;
cp.setToDefault();
cp.mType = NxOgre::CharacterParams::CT_Box;
cp.mDimensions.set(2);
m_nxCharacter = mNxScene->createCharacter("myCharacter", pos, cp);


As you can see, there's a weird gap between the body and the character. But not only this, but the body penetrates the floor (the red line indicates the intersection), and seems to collide only with the world floor.. And finally, it seems that the body and the character have different sizes! when they should be the same...

Hope to get some advice on this!

Thanks! :)

betajaen

31-01-2009 10:27:51

Your forgetting to take "skin-width" into account. Also the character hovers of the ground to allow raycasting and autostepping.

rogermr

31-01-2009 17:48:57

Hi, thanks for answering so fast :)
The character hovering makes sense, didn't know that!

About the skin-width.. I had some skin width, and tried to play with different values, but I couldn't avoid penetration :/ That's why I decided to leave default values when posting the code here :/

betajaen

31-01-2009 18:36:25

No problem. I think there may be an additional value for "hovering height", but it may be just the skin-width.

Personally, I would leave it as default, and just subtract the skin-width value to the Y component when you want a position for rendering.