Get/Set FixedRotation in play mode

This commit is contained in:
Simon Lübeß
2024-01-26 12:51:29 +01:00
parent d4d6cc8e38
commit bc535ddc26
6 changed files with 58 additions and 5 deletions
+15 -1
View File
@@ -75,7 +75,7 @@ public class Rigidbody2D : Component
}
/// <summary>
/// Gets or sets the angulara velocity of the rigidbody.
/// Gets or sets the angular velocity of the rigidbody.
/// </summary>
public float AngularVelocity
{
@@ -87,4 +87,18 @@ public class Rigidbody2D : Component
}
set => ScriptGlue.Rigidbody2D_SetAngularVelocity(_uuid, value);
}
/// <summary>
/// Gets or sets whether the rigidbody can rotate or not.
/// </summary>
public bool FixedRotation
{
get
{
ScriptGlue.Rigidbody2D_IsFixedRotation(_uuid, out bool isFixedRotation);
return isFixedRotation;
}
set => ScriptGlue.Rigidbody2D_SetFixedRotation(_uuid, value);
}
}
+6
View File
@@ -112,7 +112,13 @@ internal static class ScriptGlue
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void Rigidbody2D_GetAngularVelocity(UUID entityId, out float velocity);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void Rigidbody2D_IsFixedRotation(UUID entityId, out bool isFixedRotation);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void Rigidbody2D_SetFixedRotation(UUID entityId, in bool isFixedRotation);
#endregion RigidBody2D
#region Camera