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:
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