Small Objects reacting weird?

ShUr1k3n

29-12-2009 00:08:59

Hello everyone.

I was trying to create a game that uses small objects, i mean really small, like Spheres with Radius 1.75cm (yep, centimeters). and i notice that they didn't react very well.

I have a Triangle Mesh (lets say a Box (100cm x 60cm x 15cm) with the upper face Open) and i "drop" a ball inside it, and i notice that the ball never stops "bouncing". And this didn't happens when i use larger Boxes and Balls.

Any idea why this is happening? Are the Objects to small? If this is the case, should i "scale" everything?

Like, change gravity to -98.0f Instead of -9.8f, multiply the Value of the Mass, etc?

Thanks in advance

spacegaier

08-01-2010 08:42:41

Well, I guess scaling could be one solution, but I am also pretty sure, that there are some parameters that affect the bouncing behaviour.

I can only make vague guesses (perhaps having a look at the PhysX documentation can help, to find out what the correct terms are for these values as they will be the same in NxOgre):
- damping coefficients in NxOgre::Actor
- sleep threshold also in NxOgre::Actor
- skind width in NxOgre::Shape

Did you also have a look at the RemoteDebugger, to make sure that the scene is fine (so that this ball e.g. isn't entering the box due to Non-CCD issues or similar)?

ShUr1k3n

08-01-2010 14:54:11

Hello, thanks for your reply.

Seems that the problem is the Non-CCD.

Since its not yet implemented in NxOgre, i'm trying to add it manually. But i'm getting a few questions.

For instance, in the example of CCD of PhysX they have this code:


...
// The actor has one shape, a box
NxBoxShapeDesc boxDesc;
boxDesc.dimensions.set(boxDim.x,boxDim.y,boxDim.z);
boxDesc.localPose.t = NxVec3(0,boxDim.y,0);

// Set box up with CCD skeleton
boxDesc.ccdSkeleton = CreateCCDSkeleton(boxDim.x*0.8f);
...


how can i get the parameter "ccdSkeleton" in NxOgre? If this the same? :


NxOgre::BoxDescription bd;

bd.mSkeleton = CreateCCDSkeleton(boxDim.x*0.8f);


One more thing, is there any way i can "createCCDSkeleton" from a mesh, and in "offline mode", like we do with TriangleMeshes and ConvexMeshes with Flour?

Regards

betajaen

08-01-2010 18:06:17

Can you check first with spacegaier's guesses before confirming that CCD would the the problem?

Increasing skin width and iterator count seem plausible fixes.

ShUr1k3n

08-01-2010 22:06:11

I'm trying that fixes. Thanks :)

One thing, how can i use the iterator (NxOgre::CollisionModelIterator) that i get from
mBall->getShapes();

?

EDIT: On this line:

NxOgre::CollisionModelIterator it = mBall->getShapes();

i got this error:


Error 16 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class NxOgre::const_ptr_vector_iterator<class NxOgre::Shape> __thiscall NxOgre::RigidBody::getShapes(void)const " (__imp_?getShapes@RigidBody@NxOgre@@QBE?AV?$const_ptr_vector_iterator@VShape@NxOgre@@@2@XZ) referenced in function "protected: virtual void __thiscall TestApp::createScene(void)" (?createScene@TestApp@@MAEXXZ) main.obj


Regards

spacegaier

14-01-2010 21:03:50

I just wanted to try to help you, but I can't in my NxOgre version (latest BloodyMess), there is no CollisionModelIterator. Which version are you using?

EDIT: betajaen just told me, that you are probably using Detritus, which I am not right now, so I can#t help here...

2th EDIT: The whole thing couldn't work as some functions weren't coded yet, but - as always - betajaen is offering the best support available and coding them right now. In some minutes a new commit will be made to github and you are ready to go :) .

betajaen

14-01-2010 21:26:55

In some minutes a new commit will be made to github and you are ready to go :) .

Done.

ShUr1k3n

14-01-2010 21:53:00

Thanks a lot :) Will give it a try.

Really appreciated.