ScriptCore: Added more properties to components

- Added CircleRenderer
- Transform: Added Rotation, RotationEuler, RotationAxisAngle and Scale
- RigidBody: Added BodyType and GravityScale
- Added ColorRGBA
This commit is contained in:
Simon Lübeß
2024-01-27 19:46:37 +01:00
parent bc535ddc26
commit 8ff35d3967
12 changed files with 566 additions and 22 deletions
+32
View File
@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace GlitchyEngine.Physics;
/// <summary>
/// Describes whether the rigid body is static, dynamic or kinematic.
/// </summary>
public enum BodyType : byte
{
/// <summary>
/// A static body does not move under simulation and behaves as if it has infinite mass.
/// Internally, Box2D stores zero for the mass and the inverse mass
/// Static bodies can be moved manually by the user. A static body has zero velocity.
/// Static bodies do not collide with other static or kinematic bodies.
/// </summary>
Static = 0,
/// <summary>
/// A dynamic body is fully simulated. They can be moved manually by the user, but normally they move according to forces.
/// A dynamic body can collide with all body types. A dynamic body always has finite, non-zero mass.
/// If you try to set the mass of a dynamic body to zero, it will automatically acquire a mass of one kilogram and it won't rotate.
/// </summary>
Dynamic = 1,
/// <summary>
/// A kinematic body moves under simulation according to its velocity.
/// Kinematic bodies do not respond to forces. They can be moved manually by the user, but normally a kinematic body is moved by setting its velocity.
/// A kinematic body behaves as if it has infinite mass, however, Box2D stores zero for the mass and the inverse mass.
/// Kinematic bodies do not collide with other kinematic or static bodies.
/// </summary>
Kinematic = 2
}
+30
View File
@@ -101,4 +101,34 @@ public class Rigidbody2D : Component
}
set => ScriptGlue.Rigidbody2D_SetFixedRotation(_uuid, value);
}
/// <summary>
/// Gets or sets the body type of the rigidbody.
/// </summary>
public BodyType BodyType
{
get
{
ScriptGlue.Rigidbody2D_GetBodyType(_uuid, out BodyType bodyType);
return bodyType;
}
set => ScriptGlue.Rigidbody2D_SetBodyType(_uuid, value);
}
/// <summary>
/// Gets or sets the gravity scale of this rigidbody.
/// E.g. a value of 0.0 means, that the rigidbody is not affected by gravity and a value of -1.0 means, that it gravity is inverted.
/// </summary>
public float GravityScale
{
get
{
ScriptGlue.Rigidbody2D_GetGravityScale(_uuid, out float gravityScale);
return gravityScale;
}
set => ScriptGlue.Rigidbody2D_SetGravityScale(_uuid, value);
}
}