TreeCollision with setStandardForceCallback()

Waaarg

24-09-2009 02:06:51

Hi , I have some problem with moving my object
I had create some simple object(Robot Mesh) with treecollision , and I used setStandardForceCallback() function for move my object

but It doesn't work, and I found something
when I created body with simple collision Like " OgreNewt::CollisionPrimitives::Box " -> It's work fine , that object fall down

but when I use with TreeCollision, that function doesn't work , just stuck in position

Is something I missed?


Ent_A = mSceneMgr->createEntity( "Robot", "robot.mesh" );

Node_A = mSceneMgr->getRootSceneNode()->createChildSceneNode( "RobotNode" );
Node_A->attachObject( Ent_A );
Node_A->scale(0.2,0.2,0.2);
Ent_A->setCastShadows(false);

OgreNewt::Collision* col_A = new OgreNewt::CollisionPrimitives::TreeCollision( m_World, Node_A, true);Body_A = new OgreNewt::Body(m_World,col_A);
delete col_A;

Body_A->attachToNode( Node_A );
Body_A->setPositionOrientation(Ogre::Vector3(100,300,100), Ogre::Quaternion::IDENTITY );

Body_A->setStandardForceCallback();

PJani

24-09-2009 03:34:53

will never work that way because TreeCollision is STATIC is ment to be used for static objects buildings, terrain, etc.!

take robot a part create convex hull for every single part and make compound collision from all convex hulls...

That way i do it if i have complex object.

And you will have to set mass and inertia of your body to work properly.

You will calculate inertia with one special class which you can directly cast to OgreNewt::ConvexCollision* and from there you can calculate center of mass nad inertia after that you multiply inertia with mass :p

O and simplest way if you want to create very fast one body just use one convex hull... :p

Waaarg

24-09-2009 22:02:49

aha.. Static Object

I see , Thank you for reply