I am currently trying to add some physics, the engine is written in Purebasic and I have a very annoying issue, NewtonBodyTransformCallback procedure gets called completly, it ends and then it crashes, I have no idea why it happends, all the values in the debugger look perfect!
- Code: Select all
Procedure physics_NewtonBodyTransformCallback(*body, *matrix, threadIndex.i)
; Get the position from the matrix
Dim test.f(15)
NewtonBodyGetMatrix(*body, @test())
*posit.Vector3D = Vector3D(test(12),test(13),test(14))
*rotation.Vector3D = Vector3D(0,0,0)
; we will ignore the Rotation part of matrix And use the quaternion rotation stored in the body
NewtonBodyGetRotation(*body, *rotation)
; get the entity associated With this rigid body
*ent.gameobject = NewtonBodyGetUserData(*body)
*ent\rotation\x = *rotation\x
*ent\rotation\y = *rotation\y
*ent\rotation\z = *rotation\z
*ent\position\x = *posit\x
*ent\position\y = *posit\y
*ent\position\z = *posit\z
Debug "NEW POSITION:"+Str(*ent\position\x)+","+Str(*ent\position\y)+","+Str(*ent\position\z)
Debug "A TRANSFORM CALLBACK"
EndProcedure < - CRASH!!!!!! No idea why, values look fine
Thanks for any help!

