Extremely deformed geometry

tomodachi

27-09-2008 20:41:46

Yesterday I downloaded OgreNewt to try implementing physics in my engine. Today I've been making my first attempts to get it running. I've written a method to attach a physics body to an existing node (nCharacter), and following the wiki tutorial, seeing that everywhere it's done the same way, all I get is the entity of the node deforming anormally :S

Maybe I'm missing something?

Body* Physics::setCharacter(Node* nCharacter, float fMass)
{
cout << "* Assigning physic body to character node '" << nCharacter->getName() << "'..." << endl;

float fRadius = 0.3;
float fHeight = 1.6;

Collision* coli = new CollisionPrimitives::Capsule(world, fRadius, fHeight);
Body* body = new Body(world, coli);

Ogre::Vector3 vInertia = MomentOfInertia::CalcCylinderSolid(fMass, fRadius, fHeight);
body->setMassMatrix(fMass, vInertia);
body->attachToNode(nCharacter);
body->setStandardForceCallback();

delete coli;

return body;
}


This method is member of a class Physics that inherits Ogre::FrameListener and I call world->update() in every frameStarted passing it the timeSinceLastFrame value...

Any help?

Thanks in advance!

BardockSSJ

27-09-2008 22:48:13

You .mesh character file need be center at center of bounding box. Press F3 in application and you understand what means problem.

tomodachi

28-09-2008 00:11:13

I think I understand what you meant.

What I've done now is export the mesh with the pivot centered. [EDIT] This should put the mesh strictly centered in the Collision objct [/EDIT]. I've also modified the Collision object so that it now is a box which dimensions are slightly greater than the mesh ones, just in case, but I don't think it's important.

And the result is the same as before :(

By the way, what application do you mean?

BardockSSJ

28-09-2008 08:43:02

I mean your game, default newton listener after pressing F3 shows debug mesh, you can too do it - enable debuger and showLines() hideLines(). what program to modeling you use?

tomodachi

28-09-2008 13:48:49

Oh, I see. I'm not using the basic frame listener that comes with OgreNewt, but I've just added the necesary code (init(scnMgr) and showLines(world)) to activate the debugger on my own. It's crashing when it calls the debugger init method. Everything is going wrong here :lol:

I'll try to recompile the lib later. Maybe I did something strange.

Sorry I didn't say it before. I'm working under OS X (xCode has not a good debugger...) and modelling with Maya 2008.

tomodachi

28-09-2008 23:15:56

No way :(

The demos work perfectly, but for an unknown strange reason Newton doesn't like my project...

Thanks for your support, BardockSSJ :)

BardockSSJ

29-09-2008 14:54:37

some tips of me, how in my projects works:

Debuger Init - in createFrameListener()
"OgreNewt::Debugger::getSingleton().init(Core::SceneMgr);"

Debuger DeInit in ~GameApplication()
"delete Core::Physics;"
"OgreNewt::Debugger::getSingleton().deInit();"

World init in GameApplication()
"Core::Physics=new OgreNewt::World();"

showLines/hide - anywhere in framestarted.

tomodachi

29-09-2008 16:20:21

My code looks fairly identical as yours and my application crashes when it tries to initialise the debugger. All this makes me think that Newton is not working correctly on Leopard. As far as I know (it's on the web page) this Mac library version was built on 2006, so it would not surprise me :(

I think I'll give a try to OPAL to see if i'm a bit more lucky :)

BardockSSJ

29-09-2008 18:40:09

If not working with similar code - definetly OS port causes problem..

nullsquared

01-10-2008 15:10:08

Go to the Newton forums and PM Julio for the 2.0 beta SDK, it's updated pretty much weekly and has an active Mac version. If you don't want to then use Newton directly, ask Walaber about his Newton 2.0 version of OgreNewt.