MogreNewt Help


06-12-2006 02:19:19

I'm new to the forums, and Mogre and MogreNewt too. I'm having some difficulty trying to get MogreNewt to work. I followed all the code and C++ tutorials i could find until I got it as good as I could get it. Here is the code i used to make a few stuff fall onto a box.
Here's my code:

void CreateScene()
mgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE);
mWorld = new World();
cam = mgr.CreateCamera("PlayerCamera");
//cam.Position = new Vector3(50000, 1500, 50000);
camPosition = cam.Position;
//cam.LookAt(1, 0, 0);
Radian r = new Radian();
r = 1.5f;
camLookAt = new Vector3(cam.Direction.x, cam.Direction.y, cam.Direction.z);
cam.NearClipDistance = 1;
cam.FarClipDistance = 1000000;

mgr.AmbientLight = new ColourValue(1, 1, 1);

//Load The Terrain

//All Physics Models Created Here
Vector3 size = new Vector3(100f, 1.0f, 100.0f);
SceneNode node = mgr.RootSceneNode.CreateChildSceneNode();
Entity ent = mgr.CreateEntity( "floorobj", "box.mesh" );
node.AttachObject( ent );
node.SetScale( size );

Collision col = new MogreNewt.CollisionPrimitives.Box( mWorld, size );
Body floorbody = new Body(mWorld, col);
floorbody.setPositionOrientation( new Vector3(0,-5,0), Quaternion.IDENTITY );

// cylinder with a radius of 0.5, height of 1.3
size = new Vector3( 1.3f, 0.5f, 0.5f );
node = mgr.RootSceneNode.CreateChildSceneNode();
ent = mgr.CreateEntity("cylinder_body", "cylinder.mesh" );
node.AttachObject( ent );
node.SetScale( size );

// rigid body.
col = new MogreNewt.CollisionPrimitives.Cylinder( mWorld, 0.5f, 1.3f );
Body bod = new Body( mWorld, col );
bod.attachToNode( node );

// initial position
bod.setPositionOrientation( new Vector3(-2,3,2), Quaternion.IDENTITY );

float mass = 10.0f;
Vector3 inertia = MomentOfInertia.CalcCylinderSolid( mass, 0.5f, 1.3f );

bod.setMassMatrix( mass, inertia );
bod.IsGravityEnabled = true;

//Set Fog
ColourValue fadeColour = new ColourValue(0.9f, 0.9f, 0.9f);
mgr.SetFog(FogMode.FOG_EXP, fadeColour, 0.0001f);
mgr.SetSkyDome(true, "Examples/CloudySky", 5, 8, 500, true);

It compiles but then all of a sudden I get a File Not Found Exception! out of nowhere!

I have tried everything I could and I found out that the 1 line of code that actually made the exception happen was this like:
Collision col = new MogreNewt.CollisionPrimitives.Box( mWorld, size );

Is there anything that I'm doing wrong to get that random exception? ANY help is needed and appreciated.
Thank you for your support of a n00b like me. :D :D :D


06-12-2006 03:26:12

:oops: :oops: :oops: :oops: :oops: :oops:

Now I really feel dumb. The reason I couldn't get the examples, or my own code working was because I didn't put the newton dll in the debug path. i thought that i just needed the mogrenewt dll.

:oops: :oops: :oops: :oops: :oops: :oops: