whats the problem?

bravery

26-05-2006 07:06:03

my object (ball) is always fall from the level the following image will show you what I mean:



the ball start in the top of the land and then fall throu the land.

here is how I create the physics for both the ball and land:

SceneNode* mMBallNode = mSceneMgr->getSceneNode("L1T1MBall");
SceneNode* mLevelNode = mSceneMgr->getSceneNode("L1T1Level");

OgreNewt::Collision* MBall_col = new OgreNewt::CollisionPrimitives::ConvexHull(m_World, mMBallNode);
OgreNewt::Collision* mLevel_col = new OgreNewt::CollisionPrimitives::TreeCollision(m_World, mLevelNode, true);

OgreNewt::Body* MBall_body = new OgreNewt::Body( m_World, MBall_col );
OgreNewt::Body* mLevel_body = new OgreNewt::Body(m_World, mLevel_col);

delete MBall_col;
delete mLevel_col;

Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcSphereSolid( 10.0, 1.0 );

MBall_body->setMassMatrix( 10.0, inertia );

MBall_body->attachToNode( mMBallNode );
mLevel_body->attachToNode(mLevelNode);

MBall_body->setStandardForceCallback();
mLevel_body->setStandardForceCallback();



so what to do? can anyone suggest any help?

walaber

26-05-2006 07:33:10

TreeCollision won't work with a single flat plane... it needs at least 2 different planes to work... try it with a slightly more complex ground object.

also you do not need to set the standardForceTorqueCallback() on the ground body, because it is static.

bravery

26-05-2006 11:54:00

It's not a single plan it's acually a compination of 3 attached planes this is the pic. from another side



note: I use oFusion to export this level.

so please tell how to solve this problem?

walaber

26-05-2006 16:19:04

have you setup the debugger to see if the collision is being created properly?

if you are using OgreNewt::BasicFrameListener, just press F3 and see if the lines show up.

if you aren't using the BasicFrameListener, have a look at the OgreNewt::Debugger class.

bravery

26-05-2006 19:20:57

I think there is no problem with the lines, here is a screenshot :



so what do you think why the ball fall down ?

walaber

26-05-2006 21:51:37

what version of Newton SDK are you using?

bravery

26-05-2006 21:54:42

It's Newton SDK 1.52

walaber

26-05-2006 22:55:24

hmmm... I am stumped. the only thing I can think of is vertex winding...

bravery

27-05-2006 17:27:15

walaber

can I send to you my project so you can check whats the problem there??

thanks in advance

pfo

28-05-2006 00:14:38

You might want to check that your object has a proper inertia set, bad values can cause undesired behavior. Try testing other collision primitives against the floor and see if they work.

posixninja

28-05-2006 14:30:49

perhaps the mesh need to be tris? try adding some more verticies or faces on the planes