mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Disposable Rigidbody2D
This commit is contained in:
@@ -375,7 +375,7 @@ namespace GlitchyEngine.World
|
|||||||
public SceneLight SceneLight;
|
public SceneLight SceneLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Rigidbody2DComponent
|
struct Rigidbody2DComponent : IDisposableComponent
|
||||||
{
|
{
|
||||||
public enum BodyType { Static = 0, Dynamic = 1, Kinematic = 2 }
|
public enum BodyType { Static = 0, Dynamic = 1, Kinematic = 2 }
|
||||||
|
|
||||||
@@ -497,6 +497,12 @@ namespace GlitchyEngine.World
|
|||||||
if (RuntimeBody != null)
|
if (RuntimeBody != null)
|
||||||
Box2D.Body.SetAngularVelocity(RuntimeBody, velocity);
|
Box2D.Body.SetAngularVelocity(RuntimeBody, velocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
if (RuntimeBody != null && ScriptEngine.Context?.[Friend]_physicsWorld2D != null)
|
||||||
|
Box2D.World.DestroyBody(ScriptEngine.Context.[Friend]_physicsWorld2D, RuntimeBody);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*struct InternalBug
|
/*struct InternalBug
|
||||||
|
|||||||
Reference in New Issue
Block a user