[BloodyMess]Sphere falls through scene geometry

AWHDRi

03-08-2009 12:48:16

Hello, that's me again. I'm working on table tennis game. I have single mesh for scene geometry and ball mesh.
The problem
My ball falls through the geometry of the scene or stuck in it. If the ball falls from small height (up to meter), it is looks like attached to the surface and moves
like has big mass. Also the ball is always shaking.
Ball creation code
if(mKeyboard->isKeyDown(OIS::KC_SPACE) && mTimeUntilNextToggle <= 0)
{
NxOgre::RigidBodyDescription balldesc;
balldesc.mMass = Real(0.003);
//balldesc.mBodyFlags |= NxOgre::Enums::ShapeFlags_DynamicDynamicCCD;
//NxOgre::ResourceSystem::getSingleton()->openArchive("shared", "file:content/stage/shared");
// NxOgre::Mesh* ball = NxOgre::MeshManager::getSingleton()->load("shared:ball.mesh.nxs");
mBall = mRenderSystem->createBody(new NxOgre::Sphere(0.02), NxOgre::Real3(mCamera->getPosition().x,
mCamera->getPosition().y, mCamera->getPosition().z), "ball.mesh", balldesc);
mTimeUntilNextToggle = 0.2;
}

Scene geometry creation code
NxOgre::ResourceSystem::getSingleton()->openArchive("content", "file:content/stage/stg1");
NxOgre::Mesh* triangleMesh = NxOgre::MeshManager::getSingleton()->load("content:Model.mesh.nxs");
mScene->createSceneGeometry(triangleGeometry, NxOgre::Matrix44(NxOgre::Real3(0, 0, 0)));

What I am trying to do
- Subdivision of scene mesh
- adding NxOgre::Enums::ShapeFlags_DynamicDynamicCCD flag to ball body description
- adding force to ball from volume callbacks (not working/when ball shape is triangle mesh and it interact with the volume app crashes)

betajaen

03-08-2009 15:33:27

I said in your previous post, you should really not use the TriangleMesh for accurate collisions like that. Using TriangleGeometry for macro-sized enivornments is fine (players, houses) but in the micro-world (table tennis balls, small tables, paddles, etc.) the triangle mesh is far to inaccurate for collisions.

You need to make your table tennis table using a several Cubes (legs and the surface), a plane for the floor, and possibly triangle mesh for "non-critical parts" such as the audience seating.

AWHDRi

03-08-2009 16:53:28

I set ball mass to 3g, but ball look like 1kg or more. It sticks to surfaces and to other balls.Why?

And one more question - using triangle mesh as volume - bad idea?

betajaen

03-08-2009 17:03:13

It isn't the physics part of PhysX causing you problems is the collision part of PhysX which is giving you problems. Which is why you should use more simplier and faster/more accurate shapes to work with.

AWHDRi

03-08-2009 17:17:47

And what i can do in my case?

betajaen

03-08-2009 17:22:54

I told you. Replace your triangle geometry with more simpler versions; it's up there in my first post. You can still use parts of your original mesh for background/non-important stuff. But mission critical things should be done by primitive shapes.

AWHDRi

03-08-2009 17:44:37

I understand you. I already have a plane and try ball on it. The ball does not falls, and not stuck, but other problems remain

betajaen

03-08-2009 17:59:26

Since your working with small scales, try working in a Centimetre-Gram-Second system instead of the MKS system currently used by default.

i.e.

ballDesc.mMass = 3; // grams
new Sphere(2); // cm

Remember to scale up your forces (newtons into dynes) and torques(newton metres into dyne centimetres), and any time values stay as they are.

Your less likely to have any shaking problems with larger objects - due to them being more "noticeable" now.