Struct PhysicsWorld
A collection of rigid bodies and joints.
Inherited Members
Namespace: Unity.Physics
Syntax
[NoAlias]
public struct PhysicsWorld : ICollidable, IAspectQueryable, IDisposable
Constructors
PhysicsWorld(Int32, Int32, Int32)
Construct a world with the given number of uninitialized bodies and joints.
Declaration
public PhysicsWorld(int numStaticBodies, int numDynamicBodies, int numJoints)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numStaticBodies | Number of static bodies. |
Int32 | numDynamicBodies | Number of dynamic bodies. |
Int32 | numJoints | Number of joints. |
Fields
CollisionWorld
Stores rigid bodies and broadphase.
Declaration
[NoAlias]
public CollisionWorld CollisionWorld
Field Value
Type | Description |
---|---|
CollisionWorld |
DynamicsWorld
Stores motions and joints.
Declaration
[NoAlias]
public DynamicsWorld DynamicsWorld
Field Value
Type | Description |
---|---|
DynamicsWorld |
Properties
Bodies
Gets the bodies.
Declaration
public readonly NativeArray<RigidBody> Bodies { get; }
Property Value
Type | Description |
---|---|
NativeArray<RigidBody> | The bodies. |
DynamicBodies
Gets the dynamic bodies.
Declaration
public readonly NativeArray<RigidBody> DynamicBodies { get; }
Property Value
Type | Description |
---|---|
NativeArray<RigidBody> | The dynamic bodies. |
Joints
Gets the joints.
Declaration
public readonly NativeArray<Joint> Joints { get; }
Property Value
Type | Description |
---|---|
NativeArray<Joint> | The joints. |
MotionDatas
Gets the motion datas.
Declaration
public readonly NativeArray<MotionData> MotionDatas { get; }
Property Value
Type | Description |
---|---|
NativeArray<MotionData> | The motion datas. |
MotionVelocities
Gets the motion velocities.
Declaration
public readonly NativeArray<MotionVelocity> MotionVelocities { get; }
Property Value
Type | Description |
---|---|
NativeArray<MotionVelocity> | The motion velocities. |
NumBodies
Gets the number of bodies.
Declaration
public readonly int NumBodies { get; }
Property Value
Type | Description |
---|---|
Int32 | The total number of bodies. |
NumDynamicBodies
Gets the number of dynamic bodies.
Declaration
public readonly int NumDynamicBodies { get; }
Property Value
Type | Description |
---|---|
Int32 | The total number of dynamic bodies. |
NumJoints
Gets the number of joints.
Declaration
public readonly int NumJoints { get; }
Property Value
Type | Description |
---|---|
Int32 | The total number of joints. |
NumStaticBodies
Gets the number of static bodies.
Declaration
public readonly int NumStaticBodies { get; }
Property Value
Type | Description |
---|---|
Int32 | The total number of static bodies. |
StaticBodies
Gets the static bodies.
Declaration
public readonly NativeArray<RigidBody> StaticBodies { get; }
Property Value
Type | Description |
---|---|
NativeArray<RigidBody> | The static bodies. |
Methods
BoxCast(float3, quaternion, float3, float3, Single, 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. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
BoxCast(float3, quaternion, float3, float3, Single, 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. |
Single | maxDistance | The maximum distance. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
BoxCastAll(float3, quaternion, float3, float3, Single, 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. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
BoxCastCustom<T>(float3, quaternion, float3, float3, Single, 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. |
Single | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
CalculateAabb()
Calculates the aabb.
Declaration
public Aabb CalculateAabb()
Returns
Type | Description |
---|---|
Aabb | The calculated aabb. |
Implements
CalculateDistance(in ColliderAspect, Single, ref NativeList<DistanceHit>, QueryInteraction)
Calculates the distance from an 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. |
Single | maxDistance | The maximum distance. |
NativeList<DistanceHit> | allHits | [in,out] all hits. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CalculateDistance(in ColliderAspect, Single, out DistanceHit, QueryInteraction)
Calculates the distance from an 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. |
Single | maxDistance | The maximum distance. |
DistanceHit | closestHit | [out] The closest hit. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CalculateDistance(in ColliderAspect, Single, QueryInteraction)
Calculates the distance from an aspect.
Declaration
public bool CalculateDistance(in ColliderAspect colliderAspect, float maxDistance, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
ColliderAspect | colliderAspect | The collider aspect. |
Single | maxDistance | The maximum distance. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CalculateDistance(ColliderDistanceInput)
Calculates the distance.
Declaration
public bool CalculateDistance(ColliderDistanceInput input)
Parameters
Type | Name | Description |
---|---|---|
ColliderDistanceInput | input | The input. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CalculateDistance(PointDistanceInput)
Calculates the distance.
Declaration
public bool CalculateDistance(PointDistanceInput input)
Parameters
Type | Name | Description |
---|---|---|
PointDistanceInput | input | The input. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CalculateDistance<T>(in ColliderAspect, Single, ref T, QueryInteraction)
Calculates the distance from an 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. |
Single | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
CapsuleCast(float3, float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CapsuleCast(float3, float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | maxDistance | The maximum distance. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CapsuleCastAll(float3, float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CapsuleCastCustom<T>(float3, float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
CastCollider(in ColliderAspect, float3, Single, ref NativeList<ColliderCastHit>, QueryInteraction)
Cast an aspect against this PhysicsWorld.
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. |
Single | maxDistance | The maximum distance. |
NativeList<ColliderCastHit> | allHits | [in,out] all hits. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CastCollider(in ColliderAspect, float3, Single, out ColliderCastHit, QueryInteraction)
Cast an aspect against this PhysicsWorld.
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. |
Single | maxDistance | The maximum distance. |
ColliderCastHit | closestHit | [out] The closest hit. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CastCollider(in ColliderAspect, float3, Single, QueryInteraction)
Cast an aspect against this PhysicsWorld.
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. |
Single | maxDistance | The maximum distance. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CastCollider(ColliderCastInput)
Cast collider.
Declaration
public bool CastCollider(ColliderCastInput input)
Parameters
Type | Name | Description |
---|---|---|
ColliderCastInput | input | The input. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CastCollider<T>(in ColliderAspect, float3, Single, ref T, QueryInteraction)
Cast an aspect against this PhysicsWorld.
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. |
Single | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
CastRay(RaycastInput)
Cast ray.
Declaration
public bool CastRay(RaycastInput input)
Parameters
Type | Name | Description |
---|---|---|
RaycastInput | input | The input. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CheckCapsule(float3, float3, Single, 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. |
Single | radius | The radius. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
CheckSphere(float3, Single, CollisionFilter, QueryInteraction)
Checks if a sphere is overlapping with this world.
Declaration
public bool CheckSphere(float3 position, float radius, CollisionFilter filter, QueryInteraction queryInteraction = QueryInteraction.Default)
Parameters
Type | Name | Description |
---|---|---|
float3 | position | The position. |
Single | radius | The radius. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
Clone()
Clone the world.
Declaration
public PhysicsWorld Clone()
Returns
Type | Description |
---|---|
PhysicsWorld | A copy of this object. |
Dispose()
Free internal memory.
Declaration
public void Dispose()
Implements
GetJointIndex(Entity)
Gets the zero-based index of the joint.
Declaration
public int GetJointIndex(Entity entity)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
Returns
Type | Description |
---|---|
Int32 | The joint index. |
GetRigidBodyIndex(Entity)
Gets the zero-based index of the rigid body.
Declaration
public int GetRigidBodyIndex(Entity entity)
Parameters
Type | Name | Description |
---|---|---|
Entity | entity | The entity. |
Returns
Type | Description |
---|---|
Int32 | The rigid body index. |
OverlapAabb(OverlapAabbInput, ref NativeList<Int32>)
Overlap aabb.
Declaration
public bool OverlapAabb(OverlapAabbInput input, ref NativeList<int> allHits)
Parameters
Type | Name | Description |
---|---|---|
OverlapAabbInput | input | The input. |
NativeList<Int32> | allHits | [in,out] all hits. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
OverlapCapsule(float3, float3, Single, 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. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
OverlapCapsuleCustom<T>(float3, float3, Single, 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. |
Single | radius | The radius. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
OverlapSphere(float3, Single, 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. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
OverlapSphereCustom<T>(float3, Single, 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. |
Single | radius | The radius. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
Reset(Int32, Int32, Int32)
Reset the number of bodies and joints in the world.
Declaration
public void Reset(int numStaticBodies, int numDynamicBodies, int numJoints)
Parameters
Type | Name | Description |
---|---|---|
Int32 | numStaticBodies | Number of static bodies. |
Int32 | numDynamicBodies | Number of dynamic bodies. |
Int32 | numJoints | Number of joints. |
SphereCast(float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
SphereCast(float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | maxDistance | The maximum distance. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
SphereCastAll(float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | 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 |
---|---|
Boolean | True if there is a hit, false otherwise. |
Implements
SphereCastCustom<T>(float3, Single, float3, Single, 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. |
Single | radius | The radius. |
float3 | direction | The direction. |
Single | maxDistance | The maximum distance. |
T | collector | [in,out] The collector. |
CollisionFilter | filter | Specifies the filter. |
QueryInteraction | queryInteraction | (Optional) The query interaction. |
Returns
Type | Description |
---|---|
Boolean | True if there is a hit, false otherwise. |
Type Parameters
Name | Description |
---|---|
T | Generic type parameter. |
Implements
UpdateIndexMaps()
NOTE: The BuildPhysicsWorld system updates the Body and Joint Index Maps. If the PhysicsWorld is being setup and updated directly then this UpdateIndexMaps function should be called manually as well.
Declaration
public void UpdateIndexMaps()