Class Collider3D
RigidBody3D enable your entities to act under the control of physics. The Rigidbody can receive forces and torque to make your objects move in a realistic way. Any entity must contain a Rigidbody to be influenced by gravity, act under added forces or interact with other objects through physics engine.
Inheritance
Implements
Inherited Members
Namespace: Evergine.Framework.Physics3D
Assembly: Evergine.Framework.dll
Syntax
public abstract class Collider3D : Component, IDependencyObject
Constructors
Collider3D()
Initializes a new instance of the Collider3D class.
Declaration
public Collider3D()
Fields
MinSize
The minimum size of a box.
Declaration
protected static readonly float MinSize
Field Value
Type | Description |
---|---|
float |
Transform3D
The transform.
Declaration
[BindComponent(true, true, BindComponentSource.Owner, null, true)]
public Transform3D Transform3D
Field Value
Type | Description |
---|---|
Transform3D |
margin
The collision margin.
Declaration
protected float margin
Field Value
Type | Description |
---|---|
float |
model
The model component.
Declaration
[BindComponent(false, false, BindComponentSource.Owner, null, true)]
protected BaseModel model
Field Value
Type | Description |
---|---|
BaseModel |
offset
Gets the center of the shape.
Declaration
protected Vector3 offset
Field Value
Type | Description |
---|---|
Vector3 |
physicBody
The attached rigid body.
Declaration
protected PhysicBody3D physicBody
Field Value
Type | Description |
---|---|
PhysicBody3D |
usedTransform
The transform used by this collider (because it has the rigid body component).
Declaration
protected Transform3D usedTransform
Field Value
Type | Description |
---|---|
Transform3D |
Properties
EffectiveOffset
Gets the effective offset. It includes the model bounding box offset if it is available.
Declaration
public Vector3 EffectiveOffset { get; }
Property Value
Type | Description |
---|---|
Vector3 |
InternalColliderShape
Gets or sets the collider shape.
Declaration
public abstract IColliderShape3D InternalColliderShape { get; protected set; }
Property Value
Type | Description |
---|---|
IColliderShape3D |
Margin
Gets or sets the collision margin of this shape.
Declaration
[RenderPropertyAsFInput(MinLimit = 0)]
public float Margin { get; set; }
Property Value
Type | Description |
---|---|
float |
Offset
Gets or sets the collider center.
Declaration
public Vector3 Offset { get; set; }
Property Value
Type | Description |
---|---|
Vector3 |
OffsetTransform
Gets or sets the collider offset transform.
Declaration
public Matrix4x4 OffsetTransform { get; protected set; }
Property Value
Type | Description |
---|---|
Matrix4x4 |
PhysicBody
Gets the internal RigidBody 3D object.
Declaration
public PhysicBody3D PhysicBody { get; }
Property Value
Type | Description |
---|---|
PhysicBody3D |
Methods
AddShapeToRigidBody()
Adds the shape to the rigid body.
Declaration
protected virtual void AddShapeToRigidBody()
BaseCreateColliderShape()
Base method to create a collider shape.
Declaration
protected virtual void BaseCreateColliderShape()
CreateColliderShape3D()
Creates the physic object.
Declaration
protected abstract IColliderShape3D CreateColliderShape3D()
Returns
Type | Description |
---|---|
IColliderShape3D | A new physics object. |
OnAttached()
Invoked when the object is attached to the system.
Declaration
protected override bool OnAttached()
Returns
Type | Description |
---|---|
bool | True if all is OK. |
Overrides
OnDetach()
Invoked when the object is detached.
Declaration
protected override void OnDetach()
Overrides
OnModelRefreshed()
The model is refreshed.
Declaration
protected virtual void OnModelRefreshed()
OnScaleChanged(object, EventArgs)
On scale changed.
Declaration
protected virtual void OnScaleChanged(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
object | sender | The sender. |
EventArgs | e | The event arguments. |
PointTest(Vector3)
Test if a point is inside this collider.
Declaration
public bool PointTest(Vector3 position)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | position | The position in world coordinates. |
Returns
Type | Description |
---|---|
bool | True if this position is inside this collider. |
RaiseShapeChanged()
Indicates the shape has changed its dimensions.
Declaration
protected void RaiseShapeChanged()
RefreshHierarchyTransform()
Refresh the hierarchy transform.
Declaration
protected virtual void RefreshHierarchyTransform()
RefreshOffsetTransform(Vector3)
Refresh the hierarchy transform.
Declaration
protected Matrix4x4 RefreshOffsetTransform(Vector3 initialOffset)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | initialOffset | The initial offset. |
Returns
Type | Description |
---|---|
Matrix4x4 | The offset transform. |
RefreshOffsetTransform(Vector3, Quaternion, bool)
Refresh the hierarchy transform.
Declaration
protected Matrix4x4 RefreshOffsetTransform(Vector3 initialOffset, Quaternion initialOrientation, bool centerBBox = true)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | initialOffset | The initial offset. |
Quaternion | initialOrientation | The initial orientation. |
bool | centerBBox | Apply BBox center offset. |
Returns
Type | Description |
---|---|
Matrix4x4 | The offset transform. |
RefreshShapeDimensions()
Refresh the shape dimensions.
Declaration
protected abstract void RefreshShapeDimensions()
RemoveCollider()
Remove collider.
Declaration
protected void RemoveCollider()
Start()
Invoked to start the object.
Declaration
protected override void Start()
Overrides
SweepTest(Vector3, float, CollisionCategory3D)
Tests if this shape would collide with anything, if it was moved in the specified direction.
Declaration
public HitResult3D SweepTest(Vector3 direction, float maxDistance, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | direction | The direction. |
float | maxDistance | Max distance of the test. |
CollisionCategory3D | filterMask | Collider shape mask. |
Returns
Type | Description |
---|---|
HitResult3D | Hit information. |
SweepTestAll(Vector3, float, ICollection<HitResult3D>, CollisionCategory3D)
Tests if this shape would collide with anything, if it was moved in the specified direction.
Declaration
public void SweepTestAll(Vector3 direction, float maxDistance, ICollection<HitResult3D> resultsOutput, CollisionCategory3D filterMask = CollisionCategory3D.All)
Parameters
Type | Name | Description |
---|---|---|
Vector3 | direction | The direction. |
float | maxDistance | Max distance of the test. |
ICollection<HitResult3D> | resultsOutput | The collection where the contact results will be included. |
CollisionCategory3D | filterMask | Collider shape mask. |
Events
OnShapeChanged
The collider shape has changed its dimesions properties.
Declaration
public event EventHandler OnShapeChanged
Event Type
Type | Description |
---|---|
EventHandler |