mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Invoke on collision enter + start of attach child colliders to rigidbody
+ Changed default Namespace of ScriptCore to GlitchyEngine + Implicit Casts float2 <-> b2Vec2 + Entity constructor internal + Renamed RigidBody2D to Rigidbody2D (notice the B) + Basic Debug Draw actual 2D Colliders + Added Entity::GetParentWithComponent
This commit is contained in:
@@ -2,7 +2,7 @@ using GlitchyEngine.Math;
|
||||
|
||||
namespace GlitchyEngine;
|
||||
|
||||
public class RigidBody2D : Component
|
||||
public class Rigidbody2D : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Apply a force at a world point.
|
||||
|
||||
@@ -15,17 +15,13 @@ internal struct EntityHandle
|
||||
|
||||
public class Entity : EngineObject
|
||||
{
|
||||
//private UUID _uuid;
|
||||
|
||||
//public UUID UUID => _uuid;
|
||||
|
||||
/// <summary>
|
||||
/// Empty constructor not used. Do NOT USE!
|
||||
/// </summary>
|
||||
protected Entity()
|
||||
{ }
|
||||
|
||||
private Entity(UUID uuid)
|
||||
internal Entity(UUID uuid)
|
||||
{
|
||||
_uuid = uuid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
using System.Runtime.InteropServices;
|
||||
using GlitchyEngine.Core;
|
||||
|
||||
namespace GlitchyEngine.Physics;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack=1)]
|
||||
public struct Collision2D
|
||||
{
|
||||
private UUID _entity;
|
||||
private UUID _otherEntity;
|
||||
|
||||
private UUID _rigidbody;
|
||||
private UUID _otherRigidbody;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Entity whose Collider takes part in the collision.
|
||||
/// This entity is either the entity of the script instance receiving the event or a child of it.
|
||||
/// </summary>
|
||||
public Entity Entity => new(_entity);
|
||||
/// <summary>
|
||||
/// Gets the other Entity whose collider takes part in the collision.
|
||||
/// </summary>
|
||||
public Entity OtherEntity => new(_otherEntity);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the rigidbody whose Collider takes part in the collision.
|
||||
/// This Rigidbody is either a component of the entity whose script instance received the event or a parent of it.
|
||||
/// </summary>
|
||||
public Rigidbody2D Rigidbody => new() { Entity = Entity };
|
||||
|
||||
/// <summary>
|
||||
/// Gets the other rigidbody whose Collider takes part in the collision.
|
||||
/// </summary>
|
||||
public Rigidbody2D OtherRigidbody => new() { Entity = OtherEntity };
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<BaseOutputPath></BaseOutputPath>
|
||||
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
|
||||
<RootNamespace>GlitchyEngine</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
|
||||
Reference in New Issue
Block a user