mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added basic component access in Scripts
This commit is contained in:
@@ -2,7 +2,7 @@ using GlitchyEngine.Core;
|
||||
|
||||
namespace GlitchyEngine;
|
||||
|
||||
public class Component : EngineObject
|
||||
public abstract class Component
|
||||
{
|
||||
|
||||
public Entity Entity { get; internal set; }
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
using GlitchyEngine.Math;
|
||||
|
||||
namespace GlitchyEngine;
|
||||
|
||||
public class RigidBody2D : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply a force at a world point.
|
||||
/// If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity.
|
||||
/// This wakes up the body.
|
||||
/// </summary>
|
||||
/// <param name="force">The world force vector, usually in Newtons (N).</param>
|
||||
/// <param name="point">The world position of the point of application.</param>
|
||||
/// <param name="wakeUp">Wake up the body</param>
|
||||
public void ApplyForce(Vector2 force, Vector2 point, bool wakeUp = true)
|
||||
{
|
||||
ScriptGlue.RigidBody2D_ApplyForce(Entity._uuid, force, point, wakeUp);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply a force to the center of mass.
|
||||
/// This wakes up the body.
|
||||
/// </summary>
|
||||
/// <param name="force">The world force vector, usually in Newtons (N).</param>
|
||||
/// <param name="wakeUp">Wake up the body</param>
|
||||
public void ApplyForceToCenter(Vector2 force, bool wakeUp = true)
|
||||
{
|
||||
ScriptGlue.RigidBody2D_ApplyForceToCenter(Entity._uuid, force, wakeUp);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,20 @@
|
||||
using GlitchyEngine.Core;
|
||||
using GlitchyEngine.Math;
|
||||
|
||||
namespace GlitchyEngine;
|
||||
|
||||
public class Transform : EngineObject
|
||||
public class Transform : Component
|
||||
{
|
||||
|
||||
public Vector3 Translation
|
||||
{
|
||||
get
|
||||
{
|
||||
ScriptGlue.Transform_GetTranslation(Entity.UUID, out Vector3 translation);
|
||||
return translation;
|
||||
}
|
||||
set
|
||||
{
|
||||
ScriptGlue.Transform_SetTranslation(Entity.UUID, in value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user