Jump to content

.NET Headers 2.0


L B
 Share

Recommended Posts

Hi and great work. It's good to see solid support for C# and continuity in development :) ... although I'm struggling with event callbacks, to be precise with the collision callback!

 

I don't get it working. I always receive a FatalExecutionEngineError which reads as follows:

 

The runtime has encountered a fatal error. The address of the error was at 0x662cee12, on thread 0x1950. The error code is 0xc0000005. This error may be a bug in the CLR or in the unsafe or non-verifiable portions of user code. Common sources of this bug include user marshaling errors for COM-interop or PInvoke, which may corrupt the stack.

 

Some code to it:

var groundBody = new Body.Box(10, 0.1f, 5) {CollisionType = 1};
var ground = new Mesh.Cube { Color = Leadwerks.Color.SandyBrown, Scale = { X = 5, Y = 0.2f, Z = 2 }, Parent = groundBody };

groundBody.Position = new Vector3( 0, -0.5f, -1 );

var sphereBody = new Body.Sphere(0.045f) {  Mass = 1, CollisionType = 1, Elasticity = 2f};
var sphere = new Mesh.Sphere { Scale = new Vector3(0.05f, 0.05f, 0.05f), Parent = sphereBody, Position = sphereBody.Position};

sphereBody.Position = new Vector3(0, -0.65f, 0);

sphereBody.Callback(sphereCollisionCallback, (int)EntityCallbackType.Collision);

 

The main loop:

while (!Window.HasRequestedClose)
{
     if ( Leadwerks.Keyboard.KeyHit(Key.U)) {
           sphereBody.Velocity = sphereBody.CalculateVelocity(new Vector3(0, 1, 0), 3.125f);
     }

    Timing.Update();
    Framework.Update();
    Framework.Render();

    Leadwerks.Graphics.Flip();
}

 

And the callback itself:

 

        public void sphereCollisionCallback(IntPtr entity1, IntPtr entity2, Vector3 _position, Vector3 _normal, Vector3 _force, float speed) {
           Core.HideEntity(entity2);
       }

 

Is this a bug in the implementation of the headers when handling callbacks / delegates internally?

Did I make some mistake somewhere?

 

I am using Visual Studio 2010 Prof, Windows 7 x64 and the latest C# Headers 2.0 from Aug. 26th.

 

Glad for any help I can get ...

 

Best regards

post-1460-019185200 1283137209_thumb.png

Link to comment
Share on other sites

Are you utilizing our custom engine DLL, or the one provided with the SDK?

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Link to comment
Share on other sites

FatalExecutionEngineError

 

I have attached a small test class that should reproduce the behaviour. Simply call it quick and dirty using:

 

new TestCollisionCallback().RunTest();

 

 

Edit:

And press the "U" Key once or a couple of times, so that you see a sphere jumping up and falling down (I admit, it's way too fast).

As soon as collision is detected, the error occurs.

 

Best regards

 

 

 

TestCollisionCallback.txt

Edited by alphabit
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...