2D Physics and script improvements

- fixed time step
- Fixed crash caused by physics script callback being registered in simulation mode
- Moved 2D Physics config to file
- Finally gave up on the attempt to keep X and Y rotation when applying new Z-rotation from 2D rigidbody to transform and now I can sleep well
- Streamlined starting and stopping of scenes
- Scripts: execute all inits and OnCreates before OnUpdate
This commit is contained in:
Simon Lübeß
2024-01-22 23:19:55 +01:00
parent 7f40ae038a
commit 7026be1c90
4 changed files with 196 additions and 125 deletions
+2 -4
View File
@@ -731,8 +731,7 @@ static class ScriptGlue
{
Scene scene = ScriptEngine.Context;
var box2DGravity = Box2D.World.GetGravity(scene.[Friend]_physicsWorld2D);
gravity = *(float2*)&box2DGravity;
gravity = scene.Physics2DSettings.Gravity;
}
[RegisterCall("ScriptGlue::Physics2D_SetGravity")]
@@ -740,8 +739,7 @@ static class ScriptGlue
{
Scene scene = ScriptEngine.Context;
#unwarn
Box2D.World.SetGravity(scene.[Friend]_physicsWorld2D, gravity);
scene.Physics2DSettings.Gravity = gravity;
}
#endregion Physics2D