BoxCollider
Namespace: MonineEngine.Physics
A collider component, that uses a rectangle as the collision bounding.
public class BoxCollider : MonineEngine.Core.Collider
Inheritance Object → Component → Collider → BoxCollider
Fields
Offset
public Vector2 Offset;
IsTrigger
public bool IsTrigger;
Properties
Size
Gets or sets the size of the in this collider.
public Vector2 Size { get; set; }
Property Value
Vector2
Enabled
public bool Enabled { get; set; }
Property Value
Entity
public Entity Entity { get; internal set; }
Property Value
Entity
Parent
public Entity Parent { get; }
Property Value
Entity
Transform
public Transform Transform { get; }
Property Value
Transform
Camera
public Camera2D Camera { get; }
Property Value
Camera2D
Constructors
BoxCollider(Vector2, Nullable<Vector2>)
Constructs a new BoxCollider with the given size and offset.
public BoxCollider(Vector2 size, Nullable<Vector2> offset)
Parameters
size Vector2
The size of the box, in pixels.
offset Nullable<Vector2>
The offset from the position of the to the position of the box.
Methods
GetBounds()
Gets the bounds of the box, with the center of the box being the position of the .
public Rectangle GetBounds()
Returns
Rectangle
A covering the bounds of the collider.
Intersects(Collider)
public bool Intersects(Collider other)
Parameters
other Collider
Returns
Events
OnCollisionEnter
public event Action<CollisionEventArgs> OnCollisionEnter;
OnCollisionStay
public event Action<CollisionEventArgs> OnCollisionStay;
OnCollisionExit
public event Action<CollisionEventArgs> OnCollisionExit;
OnTriggerEnter
public event Action<CollisionEventArgs> OnTriggerEnter;
OnTriggerStay
public event Action<CollisionEventArgs> OnTriggerStay;
OnTriggerExit
public event Action<CollisionEventArgs> OnTriggerExit;