MogreNewt AccessViolation SimpleVehicle example

koirat

29-02-2008 18:07:16

SimpleVehicle example:
Exception:
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.

at NewtonCreateBody(NewtonWorld* , NewtonCollision* ) at MogreNewt.Body._ctor(World W, Collision col, Int32 bodytype, Boolean enableGravity) at MogreNewt.Body..ctor(World W, Collision col) at MogreNewt.Demo.SimpleVehicle.SimpleVehicleApp.CreateScene() in E:\OgreSDK\MogreNewton-Samples\SimpleVehicle\SimpleVehicleApp.cs:line 190 at Mogre.Demo.ExampleApplication.Example.Setup() in E:\OgreSDK\Mogre-Samples\ExampleApplication\Example.cs:line 85 at Mogre.Demo.ExampleApplication.Example.Go() in E:\OgreSDK\Mogre-Samples\ExampleApplication\Example.cs:line 51 at MogreNewt.Demo.SimpleVehicle.Program.Main(String[] args) in E:\OgreSDK\MogreNewton-Samples\SimpleVehicle\Program.cs:line 15

it's this line to be more specific:
MogreNewt.Body bod = new MogreNewt.Body(m_World, col);

Basic example is working without any problem.

I'm using Newton for windows 1.53 .

koirat

29-02-2008 18:44:20

More about this :) !!

if i change this first line with the second the program is running (in it's own ill way).So it's something with creation of collision tree.


MogreNewt.Collision col = new MogreNewt.CollisionPrimitives.TreeCollision(m_World, floornode, false);

MogreNewt.Collision col = new MogreNewt.CollisionPrimitives.Box(m_World,new Vector3(10,10,10));



Btw.
If I comment this body creation line. Application throws AccessViolation Exception on disposing.

MogreNewt.Collision col = new MogreNewt.CollisionPrimitives.TreeCollision(m_World, floornode, false);
//MogreNewt.Body bod = new MogreNewt.Body(m_World, col);
col.Dispose();

koirat

04-03-2008 11:53:11

One more thing about this example.
I have downloaded OgreNewt and compared this two examples
in MogreNewt TreeCollision is used instead of TreeCollisionSceneParser as it is with Ogrenewt after changing to TreeCollisonSceneParser and parsing the scene it worked.

Put this:

MogreNewt.CollisionPrimitives.TreeCollisionSceneParser col = new MogreNewt.CollisionPrimitives.TreeCollisionSceneParser(m_World);//, floornode, false);
col.ParseScene(floornode, true);

instead of this:

MogreNewt.Collision col = new MogreNewt.CollisionPrimitives.TreeCollision(m_World, floornode, false);