Class Collider3D
RigidBody3D enables 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 the 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 transformation.
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 a rigid body component).
Declaration
protected Transform3D usedTransform
Field Value
Type | Description |
---|---|
Transform3D |
Properties
EffectiveOffset
Gets the effective offset, including the model bounding box offset if available.
Declaration
public Vector3 EffectiveOffset { get; }
Property Value
Type | Description |
---|---|
Vector3 |
InternalColliderShape
Gets or sets the collider's 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's 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 RigidBody3D 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 for creating a collider shape.
Declaration
protected virtual void BaseCreateColliderShape()
CreateColliderShape3D()
Creates the physics 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 everything is OK. |
Overrides
OnDetach()
Invoked when the object is detached.
Declaration
protected override void OnDetach()
Overrides
OnModelRefreshed()
The model has been refreshed.
Declaration
protected virtual void OnModelRefreshed()
OnScaleChanged(object, EventArgs)
On scale change.
Declaration
protected virtual void OnScaleChanged(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
object | sender | The sender. |
EventArgs | e | The event arguments. |
PointTest(Vector3)
Tests 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 that the shape has changed its dimensions.
Declaration
protected void RaiseShapeChanged()
RefreshHierarchyTransform()
Refreshes the hierarchy transformation.
Declaration
protected virtual void RefreshHierarchyTransform()
RefreshOffsetTransform(Vector3)
Refreshes 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)
Refreshes 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 | Applies BBox center offset. |
Returns
Type | Description |
---|---|
Matrix4x4 | The offset transform. |
RefreshShapeDimensions()
Refreshes the shape dimensions.
Declaration
protected abstract void RefreshShapeDimensions()
RemoveCollider()
Removes 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 were 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 | Maximum 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 were 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 | The maximum distance of the test. |
ICollection<HitResult3D> | resultsOutput | The collection where the contact results will be included. |
CollisionCategory3D | filterMask | The collider shape mask. |
Events
OnShapeChanged
The collider shape has changed its dimensions properties.
Declaration
public event EventHandler OnShapeChanged
Event Type
Type | Description |
---|---|
EventHandler |