mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Renamed RigidBody2D to Rigidbody2D
+ Math.normalize(Quaternion) + Position and Rotation properties for Rigidbody2D + use In, Out on beef side in ScriptGlue
This commit is contained in:
@@ -14,7 +14,7 @@ public class Rigidbody2D : Component
|
||||
/// <param name="wakeUp">Wake up the body</param>
|
||||
public void ApplyForce(float2 force, float2 point, bool wakeUp = true)
|
||||
{
|
||||
ScriptGlue.RigidBody2D_ApplyForce(Entity._uuid, force, point, wakeUp);
|
||||
ScriptGlue.Rigidbody2D_ApplyForce(Entity._uuid, force, point, wakeUp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -25,22 +25,34 @@ public class Rigidbody2D : Component
|
||||
/// <param name="wakeUp">Wake up the body</param>
|
||||
public void ApplyForceToCenter(float2 force, bool wakeUp = true)
|
||||
{
|
||||
ScriptGlue.RigidBody2D_ApplyForceToCenter(Entity._uuid, force, wakeUp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Sets the position of the rigidbody.
|
||||
/// </summary>
|
||||
/// <param name="position">The position of the rigidbody.</param>
|
||||
public void SetPosition(float2 position)
|
||||
{
|
||||
ScriptGlue.RigidBody2D_SetPosition(Entity._uuid, position);
|
||||
ScriptGlue.Rigidbody2D_ApplyForceToCenter(Entity._uuid, force, wakeUp);
|
||||
}
|
||||
|
||||
public float2 GetPosition()
|
||||
/// <summary>
|
||||
/// Gets or sets the global position of the rigidbody.
|
||||
/// </summary>
|
||||
public float2 Position
|
||||
{
|
||||
ScriptGlue.RigidBody2D_GetPosition(Entity._uuid, out float2 position);
|
||||
get
|
||||
{
|
||||
ScriptGlue.Rigidbody2D_GetPosition(Entity._uuid, out float2 position);
|
||||
|
||||
return position;
|
||||
return position;
|
||||
}
|
||||
set => ScriptGlue.Rigidbody2D_SetPosition(Entity._uuid, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the global rotation of the rigidbody.
|
||||
/// </summary>
|
||||
public float Rotation
|
||||
{
|
||||
get
|
||||
{
|
||||
ScriptGlue.Rigidbody2D_GetRotation(Entity._uuid, out float rotation);
|
||||
|
||||
return rotation;
|
||||
}
|
||||
set => ScriptGlue.Rigidbody2D_SetRotation(Entity._uuid, value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,16 +42,22 @@ internal static class ScriptGlue
|
||||
#region RigidBody2D
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void RigidBody2D_ApplyForce(UUID entityId, in float2 force, float2 point, bool wakeUp);
|
||||
internal static extern void Rigidbody2D_ApplyForce(UUID entityId, in float2 force, float2 point, bool wakeUp);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void RigidBody2D_ApplyForceToCenter(UUID entityId, in float2 force, bool wakeUp);
|
||||
internal static extern void Rigidbody2D_ApplyForceToCenter(UUID entityId, in float2 force, bool wakeUp);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void RigidBody2D_SetPosition(UUID entityId, in float2 position);
|
||||
internal static extern void Rigidbody2D_SetPosition(UUID entityId, in float2 position);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void RigidBody2D_GetPosition(UUID entityId, out float2 position);
|
||||
internal static extern void Rigidbody2D_GetPosition(UUID entityId, out float2 position);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void Rigidbody2D_SetRotation(UUID entityId, in float rotation);
|
||||
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
internal static extern void Rigidbody2D_GetRotation(UUID entityId, out float rotation);
|
||||
|
||||
#endregion RigidBody2D
|
||||
|
||||
|
||||
Reference in New Issue
Block a user