Rekindled Phoenix Posted August 28, 2010 Share Posted August 28, 2010 Thank you for all your hard work! Quote Link to comment Share on other sites More sharing options...
alphabit Posted August 30, 2010 Share Posted August 30, 2010 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 Quote Link to comment Share on other sites More sharing options...
TylerH Posted August 30, 2010 Share Posted August 30, 2010 Are you utilizing our custom engine DLL, or the one provided with the SDK? Quote nVidia 530M Intel Core i7 - 2.3Ghz 8GB DDR3 RAM Windows 7 Ultimate (64x)----- Visual Studio 2010 Ultimate Google Chrome Creative Suite 5 FL Studio 10 Office 15 ----- Expert Professional Expert BMX Programmer ----- Link to comment Share on other sites More sharing options...
alphabit Posted August 30, 2010 Share Posted August 30, 2010 The one provided with the headers. But also tried in my desperation with the 2.40, 2.32 and 2.31 ( knowing that it shouldn't work anyway). Quote Link to comment Share on other sites More sharing options...
CopperCircle Posted August 30, 2010 Share Posted August 30, 2010 The new headers are great, thanks. Look forward to the rest of the tutorials also. Keep up the good work. Quote Link to comment Share on other sites More sharing options...
alphabit Posted August 31, 2010 Share Posted August 31, 2010 (edited) 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 August 31, 2010 by alphabit Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.