Struct ColliderAspect
A collider aspect. Contains transform data and a collider.
Inherited Members
Namespace: Unity.Physics.Aspects
Assembly: Unity.Physics.dll
Syntax
public readonly struct ColliderAspect : IAspect, IAspectQueryable, ICollidable, IAspectCreate<ColliderAspect>, IQueryTypeParameter
Constructors
ColliderAspect(Entity, RefRW<PhysicsCollider>, RefRW<LocalTransform>)
Construct an instance of the enclosing aspect from all required data references.
Declaration
public ColliderAspect(Entity collideraspect_entityE, RefRW<PhysicsCollider> collideraspect_m_colliderRef, RefRW<LocalTransform> collideraspect_m_transformRef)
Parameters
Type | Name | Description |
---|---|---|
Entity | collideraspect_entityE | |
RefRW<PhysicsCollider> | collideraspect_m_colliderRef | |
RefRW<LocalTransform> | collideraspect_m_transformRef |
Fields
Entity
The entity of this aspect.
Declaration
public readonly Entity Entity
Field Value
Type | Description |
---|---|
Entity |
Properties
Collider
Gets or sets the collider.
Declaration
public BlobAssetReference<Collider> Collider { get; set; }
Property Value
Type | Description |
---|---|
BlobAssetReference<Collider> | The collider. |
CollisionType
Gets the collision type.
Declaration
public CollisionType CollisionType { get; }
Property Value
Type | Description |
---|---|
CollisionType | The collision type. |
Position
Gets or sets the world space position.
Declaration
public float3 Position { get; set; }
Property Value
Type | Description |
---|---|
float3 | The world space position. |
Rotation
Gets or sets the world space rotation.
Declaration
public quaternion Rotation { get; set; }
Property Value
Type | Description |
---|---|
quaternion | The world space rotation. |
Scale
Gets or sets the uniform scale.
Declaration
public float Scale { get; set; }
Property Value
Type | Description |
---|---|
float | The scale. |
Type
Gets the collider type.
Declaration
public ColliderType Type { get; }
Property Value
Type | Description |
---|---|
ColliderType | The colldier type. |
WorldFromCollider
Gets or sets the world transform of a collider aspect.
Declaration
public LocalTransform WorldFromCollider { get; set; }
Property Value
Type | Description |
---|---|
LocalTransform | The world space transform. |
Methods
AddComponentRequirementsTo(ref UnsafeList<ComponentType>)
Add component requirements from this aspect into all archetype lists.
Declaration
public void AddComponentRequirementsTo(ref UnsafeList<ComponentType> all)
Parameters
Type | Name | Description |
---|---|---|
UnsafeList<ComponentType> | all | Archetype "all" component requirements. |
AddRequiredComponentTypes(ref Span<ComponentType>)
Add component requirements from this aspect into the provided span.
Declaration
public static void AddRequiredComponentTypes(ref Span<ComponentType> componentTypes)
Parameters
Type | Name | Description |
---|---|---|
Span<ComponentType> | componentTypes | The span to which all required components in this aspect are added. |
BoxCast(float3, quaternion, float3, float3, float, out ColliderCastHit, CollisionFilter, QueryInteraction)
Box cast.
Declaration
public bool BoxCast(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, out ColliderCastHit hitInfo, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
ColliderCastHit | hitInfo | [out] Information describing the hit. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
BoxCast(float3, quaternion, float3, float3, float, CollisionFilter, QueryInteraction)
Box cast.
Declaration
public bool BoxCast(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
BoxCastAll(float3, quaternion, float3, float3, float, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)
Box cast all.
Declaration
public bool BoxCastAll(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
NativeList<ColliderCastHit> | outHits | [in,out] The out hits. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
BoxCastCustom<T>(float3, quaternion, float3, float3, float, ref T, CollisionFilter, QueryInteraction)
Box cast custom.
Declaration
public bool BoxCastCustom<T>(float3 center, quaternion orientation, float3 halfExtents, float3 direction, float maxDistance, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<ColliderCastHit>
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CalculateAabb()
Calculates the aabb of this aspect in world space.
Declaration
public Aabb CalculateAabb()
Returns
Type | Description |
---|---|
Aabb | The calculated aabb in world space. |
CalculateDistance(in ColliderAspect, float, ref NativeList<DistanceHit>, QueryInteraction)
Calculates the distance from the input aspect.
Declaration
public bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, ref NativeList<DistanceHit> allHits, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float | maxDistance | The maximum distance. |
NativeList<DistanceHit> | allHits | [in,out] all hits. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(in ColliderAspect, float, out DistanceHit, QueryInteraction)
Calculates the distance from the input aspect.
Declaration
public bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, out DistanceHit closestHit, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float | maxDistance | The maximum distance. |
DistanceHit | closestHit | [out] The closest hit. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(in ColliderAspect, float, QueryInteraction)
Calculates the distance from the input aspect.
Declaration
public bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float | maxDistance | The maximum distance. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(ColliderDistanceInput)
Calculates the distance.
Declaration
public bool CalculateDistance(ColliderDistanceInput input)
Parameters
Type | Name | Description |
---|---|---|
ColliderDistanceInput | input | The input. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(ColliderDistanceInput, ref NativeList<DistanceHit>)
Calculates the distance.
Declaration
public bool CalculateDistance(ColliderDistanceInput input, ref NativeList<DistanceHit> allHits)
Parameters
Type | Name | Description |
---|---|---|
ColliderDistanceInput | input | The input. |
NativeList<DistanceHit> | allHits | [in,out] all hits. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(ColliderDistanceInput, out DistanceHit)
Calculates the distance.
Declaration
public bool CalculateDistance(ColliderDistanceInput input, out DistanceHit closestHit)
Parameters
Type | Name | Description |
---|---|---|
ColliderDistanceInput | input | The input. |
DistanceHit | closestHit | [out] The closest hit. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(PointDistanceInput)
Calculates the distance.
Declaration
public bool CalculateDistance(PointDistanceInput input)
Parameters
Type | Name | Description |
---|---|---|
PointDistanceInput | input | The input. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(PointDistanceInput, ref NativeList<DistanceHit>)
Calculates the distance.
Declaration
public bool CalculateDistance(PointDistanceInput input, ref NativeList<DistanceHit> allHits)
Parameters
Type | Name | Description |
---|---|---|
PointDistanceInput | input | The input. |
NativeList<DistanceHit> | allHits | [in,out] all hits. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance(PointDistanceInput, out DistanceHit)
Calculates the distance.
Declaration
public bool CalculateDistance(PointDistanceInput input, out DistanceHit closestHit)
Parameters
Type | Name | Description |
---|---|---|
PointDistanceInput | input | The input. |
DistanceHit | closestHit | [out] The closest hit. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CalculateDistance<T>(in ColliderAspect, float, ref T, QueryInteraction)
Calculates the distance from the input aspect.
Declaration
public bool CalculateDistance<T>(in ColliderAspect colliderAspect, float maxDistance, ref T collector, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<DistanceHit>
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CalculateDistance<T>(ColliderDistanceInput, ref T)
Calculates the distance.
Declaration
public bool CalculateDistance<T>(ColliderDistanceInput input, ref T collector) where T : struct, ICollector<DistanceHit>
Parameters
Type | Name | Description |
---|---|---|
ColliderDistanceInput | input | The input. |
T | collector | [in,out] The collector. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CalculateDistance<T>(PointDistanceInput, ref T)
Calculates the distance.
Declaration
public bool CalculateDistance<T>(PointDistanceInput input, ref T collector) where T : struct, ICollector<DistanceHit>
Parameters
Type | Name | Description |
---|---|---|
PointDistanceInput | input | The input. |
T | collector | [in,out] The collector. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CapsuleCast(float3, float3, float, float3, float, out ColliderCastHit, CollisionFilter, QueryInteraction)
Capsule cast.
Declaration
public bool CapsuleCast(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, out ColliderCastHit hitInfo, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
ColliderCastHit | hitInfo | [out] Information describing the hit. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CapsuleCast(float3, float3, float, float3, float, CollisionFilter, QueryInteraction)
Capsule cast.
Declaration
public bool CapsuleCast(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CapsuleCastAll(float3, float3, float, float3, float, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)
Capsule cast all.
Declaration
public bool CapsuleCastAll(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
NativeList<ColliderCastHit> | outHits | [in,out] The out hits. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CapsuleCastCustom<T>(float3, float3, float, float3, float, ref T, CollisionFilter, QueryInteraction)
Capsule cast custom.
Declaration
public bool CapsuleCastCustom<T>(float3 point1, float3 point2, float radius, float3 direction, float maxDistance, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<ColliderCastHit>
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CastCollider(in ColliderAspect, float3, float, ref NativeList<ColliderCastHit>, QueryInteraction)
Cast another collider aspect against this one.
Declaration
public bool CastCollider(in ColliderAspect colliderAspect, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> allHits, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float3 | direction | The direction of the input aspect. |
float | maxDistance | The maximum distance. |
NativeList<ColliderCastHit> | allHits | [in,out] all hits. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastCollider(in ColliderAspect, float3, float, out ColliderCastHit, QueryInteraction)
Cast another collider aspect against this one.
Declaration
public bool CastCollider(in ColliderAspect colliderAspect, float3 direction, float maxDistance, out ColliderCastHit closestHit, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float3 | direction | The direction of the input aspect. |
float | maxDistance | The maximum distance. |
ColliderCastHit | closestHit | [out] The closest hit. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastCollider(in ColliderAspect, float3, float, QueryInteraction)
Cast another collider aspect against this one.
Declaration
public bool CastCollider(in ColliderAspect colliderAspect, float3 direction, float maxDistance, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float3 | direction | The direction of the input aspect. |
float | maxDistance | The maximum distance. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastCollider(ColliderCastInput)
Cast collider.
Declaration
public bool CastCollider(ColliderCastInput input)
Parameters
Type | Name | Description |
---|---|---|
ColliderCastInput | input | The input. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastCollider(ColliderCastInput, ref NativeList<ColliderCastHit>)
Cast collider.
Declaration
public bool CastCollider(ColliderCastInput input, ref NativeList<ColliderCastHit> allHits)
Parameters
Type | Name | Description |
---|---|---|
ColliderCastInput | input | The input. |
NativeList<ColliderCastHit> | allHits | [in,out] all hits. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastCollider(ColliderCastInput, out ColliderCastHit)
Cast collider.
Declaration
public bool CastCollider(ColliderCastInput input, out ColliderCastHit closestHit)
Parameters
Type | Name | Description |
---|---|---|
ColliderCastInput | input | The input. |
ColliderCastHit | closestHit | [out] The closest hit. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastCollider<T>(in ColliderAspect, float3, float, ref T, QueryInteraction)
Cast another collider aspect against this one.
Declaration
public bool CastCollider<T>(in ColliderAspect colliderAspect, float3 direction, float maxDistance, ref T collector, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<ColliderCastHit>
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
float3 | direction | The direction of the input aspect. |
float | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CastCollider<T>(ColliderCastInput, ref T)
Cast collider.
Declaration
public bool CastCollider<T>(ColliderCastInput input, ref T collector) where T : struct, ICollector<ColliderCastHit>
Parameters
Type | Name | Description |
---|---|---|
ColliderCastInput | input | The input. |
T | collector | [in,out] The collector. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CastRay(RaycastInput)
Cast ray.
Declaration
public bool CastRay(RaycastInput input)
Parameters
Type | Name | Description |
---|---|---|
RaycastInput | input | The input. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastRay(RaycastInput, ref NativeList<RaycastHit>)
Cast ray.
Declaration
public bool CastRay(RaycastInput input, ref NativeList<RaycastHit> allHits)
Parameters
Type | Name | Description |
---|---|---|
RaycastInput | input | The input. |
NativeList<RaycastHit> | allHits | [in,out] all hits. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastRay(RaycastInput, out RaycastHit)
Cast ray.
Declaration
public bool CastRay(RaycastInput input, out RaycastHit closestHit)
Parameters
Type | Name | Description |
---|---|---|
RaycastInput | input | The input. |
RaycastHit | closestHit | [out] The closest hit. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CastRay<T>(RaycastInput, ref T)
Cast ray.
Declaration
public bool CastRay<T>(RaycastInput input, ref T collector) where T : struct, ICollector<RaycastHit>
Parameters
Type | Name | Description |
---|---|---|
RaycastInput | input | The input. |
T | collector | [in,out] The collector. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
CheckBox(float3, quaternion, float3, CollisionFilter, QueryInteraction)
Check box.
Declaration
public bool CheckBox(float3 center, quaternion orientation, float3 halfExtents, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CheckCapsule(float3, float3, float, CollisionFilter, QueryInteraction)
Check capsule.
Declaration
public bool CheckCapsule(float3 point1, float3 point2, float radius, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CheckSphere(float3, float, CollisionFilter, QueryInteraction)
Checks if a sphere overlaps with this body.
Declaration
public bool CheckSphere(float3 position, float radius, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position. |
float | radius | The radius. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
CompleteDependencyBeforeRO(ref SystemState)
Completes the dependency chain required for this aspect to have read access. So it completes all write dependencies of the components, buffers, etc. to allow for reading.
Declaration
public void CompleteDependencyBeforeRO(ref SystemState state)
Parameters
Type | Name | Description |
---|---|---|
SystemState | state | The Unity.Entities.SystemState containing an Unity.Entities.EntityManager storing all dependencies. |
CompleteDependencyBeforeRW(ref SystemState)
Completes the dependency chain required for this component to have read and write access. So it completes all write dependencies of the components, buffers, etc. to allow for reading, and it completes all read dependencies, so we can write to it.
Declaration
public void CompleteDependencyBeforeRW(ref SystemState state)
Parameters
Type | Name | Description |
---|---|---|
SystemState | state | The Unity.Entities.SystemState containing an Unity.Entities.EntityManager storing all dependencies. |
ConvertChildIndexToColliderKey(int)
Convert child index to collider key.
Declaration
public ColliderKey ConvertChildIndexToColliderKey(int childIndex)
Parameters
Type | Name | Description |
---|---|---|
int | childIndex | Zero-based index of the child. |
Returns
Type | Description |
---|---|
ColliderKey | The child converted index to collider key. If the collider is not a CompoundCollider, returns Empty. |
CreateAspect(Entity, ref SystemState)
Create an instance of the enclosing aspect struct pointing at a specific entity's components data.
Declaration
public ColliderAspect CreateAspect(Entity entity, ref SystemState systemState)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity to create the aspect struct from. |
SystemState | systemState | The system state from which data is extracted. |
Returns
Type | Description |
---|---|
ColliderAspect | Instance of the aspect struct pointing at a specific entity's components data. |
GetColliderKeyToChildrenMapping(ref NativeHashMap<ColliderKey, ChildCollider>)
Has effect only if the collider is a CompoundCollider. Fills the passed in map with ColliderKey - ChildCollider pairs of the compound collider.
Declaration
public void GetColliderKeyToChildrenMapping(ref NativeHashMap<ColliderKey, ChildCollider> colliderKeyToChildrenMapping)
Parameters
Type | Name | Description |
---|---|---|
NativeHashMap<ColliderKey, ChildCollider> | colliderKeyToChildrenMapping | [in,out] The collider key to children mapping. |
GetCollisionFilter()
Get the collision filter. In case of a CompoundCollider, returns the root filter.
Declaration
public CollisionFilter GetCollisionFilter()
Returns
Type | Description |
---|---|
CollisionFilter | The collision filter. |
GetCollisionFilter(ColliderKey)
Gets the collision filter specified by the collider key. The key is only read in case the collider is CompoundCollider, otherwise it is ignored and will behave as GetCollisionFilter().
Declaration
public CollisionFilter GetCollisionFilter(ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | colliderKey | The collider key. |
Returns
Type | Description |
---|---|
CollisionFilter | The collision filter. |
GetCollisionResponse()
Gets the collision response. In case of a CompoundCollider, this behaves as GetCollisionResponse(ColliderKey) with ColliderKey.Zero passed in.
Declaration
public CollisionResponsePolicy GetCollisionResponse()
Returns
Type | Description |
---|---|
CollisionResponsePolicy | The collision response. |
GetCollisionResponse(ColliderKey)
Gets collision response of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as GetCollisionResponse() . In case of CompoundCollider if the colider key is empty, it will return the collision response of the first child.
Declaration
public CollisionResponsePolicy GetCollisionResponse(ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | colliderKey | The collider key. |
Returns
Type | Description |
---|---|
CollisionResponsePolicy | The collision response. |
GetFriction()
Gets the friction. In case of a CompoundCollider, this behaves as GetFriction(ColliderKey) with ColliderKey.Zero passed in.
Declaration
public float GetFriction()
Returns
Type | Description |
---|---|
float | The friction. |
GetFriction(ColliderKey)
Gets the friction of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as GetFriction() . In case of CompoundCollider if the colider key is empty, it will return the friction of the first child.
Declaration
public float GetFriction(ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | colliderKey | The collider key. |
Returns
Type | Description |
---|---|
float | The friction. |
GetNumberOfChildren()
Gets the children of this collider aspect.
Declaration
public int GetNumberOfChildren()
Returns
Type | Description |
---|---|
int | The number of children. If the collider is not a CompoundCollider, returns 0. |
GetRequiredComponentTypeCount()
Get the number of required (i.e. non-optional) components contained in this aspect.
Declaration
public static int GetRequiredComponentTypeCount()
Returns
Type | Description |
---|---|
int | The number of required (i.e. non-optional) components contained in this aspect. |
GetRestitution()
Gets the restitution. In case of a CompoundCollider, this behaves as GetRestitution(ColliderKey) with ColliderKey.Zero passed in.
Declaration
public float GetRestitution()
Returns
Type | Description |
---|---|
float | The restitution. |
GetRestitution(ColliderKey)
Gets a restitution of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as GetRestitution() . In case of CompoundCollider if the colider key is empty, it will return the restitution of the first child.
Declaration
public float GetRestitution(ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
ColliderKey | colliderKey | The collider key. |
Returns
Type | Description |
---|---|
float | The restitution. |
OverlapBox(float3, quaternion, float3, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)
Overlap box.
Declaration
public bool OverlapBox(float3 center, quaternion orientation, float3 halfExtents, ref NativeList<DistanceHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
NativeList<DistanceHit> | outHits | [in,out] The out hits. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
OverlapBoxCustom<T>(float3, quaternion, float3, ref T, CollisionFilter, QueryInteraction)
Overlap box custom.
Declaration
public bool OverlapBoxCustom<T>(float3 center, quaternion orientation, float3 halfExtents, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<DistanceHit>
Parameters
Type | Name | Description |
---|---|---|
float3 | center | The center. |
quaternion | orientation | The orientation. |
float3 | halfExtents | Half extents of the box. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
OverlapCapsule(float3, float3, float, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)
Overlap capsule.
Declaration
public bool OverlapCapsule(float3 point1, float3 point2, float radius, ref NativeList<DistanceHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
NativeList<DistanceHit> | outHits | [in,out] The out hits. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
OverlapCapsuleCustom<T>(float3, float3, float, ref T, CollisionFilter, QueryInteraction)
Overlap capsule custom.
Declaration
public bool OverlapCapsuleCustom<T>(float3 point1, float3 point2, float radius, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<DistanceHit>
Parameters
Type | Name | Description |
---|---|---|
float3 | point1 | The first point in capsule definition. |
float3 | point2 | The second point in capsule definition. |
float | radius | The radius. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
OverlapSphere(float3, float, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)
Overlap sphere.
Declaration
public bool OverlapSphere(float3 position, float radius, ref NativeList<DistanceHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position. |
float | radius | The radius. |
NativeList<DistanceHit> | outHits | [in,out] The out hits. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
OverlapSphereCustom<T>(float3, float, ref T, CollisionFilter, QueryInteraction)
Overlap sphere custom.
Declaration
public bool OverlapSphereCustom<T>(float3 position, float radius, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<DistanceHit>
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position. |
float | radius | The radius. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Query(EntityQuery, TypeHandle)
Enumerate the enclosing aspect from all entities in a query.
Declaration
public static ColliderAspect.Enumerator Query(EntityQuery query, ColliderAspect.TypeHandle typeHandle)
Parameters
Type | Name | Description |
---|---|---|
EntityQuery | query | The entity query to enumerate. |
ColliderAspect.TypeHandle | typeHandle | The aspect's enclosing type handle. |
Returns
Type | Description |
---|---|
ColliderAspect.Enumerator | An enumerator of all the entities instance of the enclosing aspect. |
SetCollisionFilter(CollisionFilter)
Sets the collision filter. In case of a CompoundCollider sets the root filter.
Declaration
public void SetCollisionFilter(CollisionFilter filter)
Parameters
Type | Name | Description |
---|---|---|
CollisionFilter | filter | Specifies the filter. |
SetCollisionFilter(CollisionFilter, ColliderKey)
Sets the collision filter of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetCollisionFilter(CollisionFilter)
Declaration
public void SetCollisionFilter(CollisionFilter filter, ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
CollisionFilter | filter | Specifies the filter. |
ColliderKey | colliderKey | The collider key. |
SetCollisionResponse(CollisionResponsePolicy)
Sets collision response. In case of a CompoundCollider, this behaves as SetCollisionResponse(CollisionResponsePolicy, ColliderKey) with ColliderKey.Zero passed in.
Declaration
public void SetCollisionResponse(CollisionResponsePolicy collisionResponse)
Parameters
Type | Name | Description |
---|---|---|
CollisionResponsePolicy | collisionResponse | The collision response. |
SetCollisionResponse(CollisionResponsePolicy, ColliderKey)
Sets collision response of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetCollisionResponse(CollisionResponsePolicy) . In case of CompoundCollider if the collider key is empty, it will set the collision response of the all children.
Declaration
public void SetCollisionResponse(CollisionResponsePolicy collisionResponse, ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
CollisionResponsePolicy | collisionResponse | The collision response. |
ColliderKey | colliderKey | The collider key. |
SetFriction(float)
Sets the friction. In case of a CompoundCollider, this behaves as SetFriction(float, ColliderKey) with ColliderKey.Zero passed in.
Declaration
public void SetFriction(float friction)
Parameters
Type | Name | Description |
---|---|---|
float | friction | The friction. |
SetFriction(float, ColliderKey)
Sets the friction of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetFriction(float) . In case of CompoundCollider if the collider key is empty, it will set the friction of the all children.
Declaration
public void SetFriction(float friction, ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
float | friction | The friction. |
ColliderKey | colliderKey | The collider key. |
SetRestitution(float)
Sets the restitution. In case of a CompoundCollider, this behaves as SetRestitution(float, ColliderKey) with ColliderKey.Zero passed in.
Declaration
public void SetRestitution(float restitution)
Parameters
Type | Name | Description |
---|---|---|
float | restitution | The restitution. |
SetRestitution(float, ColliderKey)
Sets the restitution of a child specified by the collider key. Collider key is only read in case of CompoundCollider, otherwise it is ignored and will behave as SetRestitution(float) . In case of CompoundCollider if the collider key is empty, it will set the restitution of the all children.
Declaration
public void SetRestitution(float restitution, ColliderKey colliderKey)
Parameters
Type | Name | Description |
---|---|---|
float | restitution | The restitution. |
ColliderKey | colliderKey | The collider key. |
SphereCast(float3, float, float3, float, out ColliderCastHit, CollisionFilter, QueryInteraction)
Sphere cast.
Declaration
public bool SphereCast(float3 origin, float radius, float3 direction, float maxDistance, out ColliderCastHit hitInfo, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | origin | The origin. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
ColliderCastHit | hitInfo | [out] Information describing the hit. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
SphereCast(float3, float, float3, float, CollisionFilter, QueryInteraction)
Sphere cast.
Declaration
public bool SphereCast(float3 origin, float radius, float3 direction, float maxDistance, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | origin | The origin. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
SphereCastAll(float3, float, float3, float, ref NativeList<ColliderCastHit>, CollisionFilter, QueryInteraction)
Sphere cast all.
Declaration
public bool SphereCastAll(float3 origin, float radius, float3 direction, float maxDistance, ref NativeList<ColliderCastHit> outHits, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | origin | The origin. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
NativeList<ColliderCastHit> | outHits | [in,out] The out hits. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
SphereCastCustom<T>(float3, float, float3, float, ref T, CollisionFilter, QueryInteraction)
Sphere cast custom.
Declaration
public bool SphereCastCustom<T>(float3 origin, float radius, float3 direction, float maxDistance, ref T collector, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default) where T : struct, ICollector<ColliderCastHit>
Parameters
Type | Name | Description |
---|---|---|
float3 | origin | The origin. |
float | radius | The radius. |
float3 | direction | The direction. |
float | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
bool | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |