Class PhysicsScene
Physical simulation scene.
Namespace: FlaxEngine
Assembly: FlaxEngine.CSharp.dll
Syntax
[Unmanaged]
public class PhysicsScene : Object
Constructors
PhysicsScene()
Properties
AutoSimulation
Gets or sets the automatic simulation feature that perform physics simulation after on fixed update by auto, otherwise user should do it.
Declaration
[Unmanaged]
public bool AutoSimulation { get; set; }
Property Value
System.Boolean
|
BounceThresholdVelocity
Gets or sets the minimum relative velocity required for an object to bounce.
Declaration
[Unmanaged]
public float BounceThresholdVelocity { get; set; }
Property Value
System.Single
|
EnableCCD
Gets or sets the CCD feature enable flag.
Declaration
[Unmanaged]
public bool EnableCCD { get; set; }
Property Value
System.Boolean
|
Gravity
Gets or sets the current gravity force.
Declaration
[Unmanaged]
public Vector3 Gravity { get; set; }
Property Value
Vector3
|
IsDuringSimulation
Checks if physical simulation is running.
Declaration
[Unmanaged]
public bool IsDuringSimulation { get; }
Property Value
System.Boolean
|
Name
Gets the name of the scene.
Declaration
[Unmanaged]
public string Name { get; }
Property Value
System.String
|
Origin
Gets or sets the current scene origin that defines the center of the simulation (in world). Can be used to run physics simulation relative to the camera.
Declaration
[Unmanaged]
public Vector3 Origin { get; set; }
Property Value
Vector3
|
Statistics
Gets the physics simulation statistics for the scene.
Declaration
[Unmanaged]
public PhysicsStatistics Statistics { get; }
Property Value
PhysicsStatistics
|
Methods
BoxCast(Vector3, Vector3, Vector3, Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a box geometry.
Declaration
[Unmanaged]
public bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Vector3
direction
The normalized direction in which cast a box. |
Quaternion
rotation
The box rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if box hits an matching object, otherwise false. |
BoxCast(Vector3, Vector3, Vector3, out RayCastHit, Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a box geometry.
Declaration
[Unmanaged]
public bool BoxCast(Vector3 center, Vector3 halfExtents, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Vector3
direction
The normalized direction in which cast a box. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if box hits an matching object, otherwise false. |
BoxCastAll(Vector3, Vector3, Vector3, out RayCastHit[], Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a box geometry.
Declaration
[Unmanaged]
public bool BoxCastAll(Vector3 center, Vector3 halfExtents, Vector3 direction, out RayCastHit[] results, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Vector3
direction
The normalized direction in which cast a box. |
RayCastHit[]
results
The result hits. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if box hits an matching object, otherwise false. |
CapsuleCast(Vector3, Single, Single, Vector3, Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a capsule geometry.
Declaration
[Unmanaged]
public bool CapsuleCast(Vector3 center, float radius, float height, Vector3 direction, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The capsule center. |
System.Single
radius
The radius of the capsule. |
System.Single
height
The height of the capsule, excluding the top and bottom spheres. |
Vector3
direction
The normalized direction in which cast a capsule. |
Quaternion
rotation
The capsule rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if capsule hits an matching object, otherwise false. |
CapsuleCast(Vector3, Single, Single, Vector3, out RayCastHit, Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a capsule geometry.
Declaration
[Unmanaged]
public bool CapsuleCast(Vector3 center, float radius, float height, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The capsule center. |
System.Single
radius
The radius of the capsule. |
System.Single
height
The height of the capsule, excluding the top and bottom spheres. |
Vector3
direction
The normalized direction in which cast a capsule. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if capsule hits an matching object, otherwise false. |
CapsuleCastAll(Vector3, Single, Single, Vector3, out RayCastHit[], Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a capsule geometry.
Declaration
[Unmanaged]
public bool CapsuleCastAll(Vector3 center, float radius, float height, Vector3 direction, out RayCastHit[] results, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The capsule center. |
System.Single
radius
The radius of the capsule. |
System.Single
height
The height of the capsule, excluding the top and bottom spheres. |
Vector3
direction
The normalized direction in which cast a capsule. |
RayCastHit[]
results
The result hits. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if capsule hits an matching object, otherwise false. |
CheckBox(Vector3, Vector3, Quaternion, UInt32, Boolean)
Checks whether the given box overlaps with other colliders or not.
Declaration
[Unmanaged]
public bool CheckBox(Vector3 center, Vector3 halfExtents, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Quaternion
rotation
The box rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if box overlaps any matching object, otherwise false. |
CheckCapsule(Vector3, Single, Single, Quaternion, UInt32, Boolean)
Checks whether the given capsule overlaps with other colliders or not.
Declaration
[Unmanaged]
public bool CheckCapsule(Vector3 center, float radius, float height, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The capsule center. |
System.Single
radius
The radius of the capsule. |
System.Single
height
The height of the capsule, excluding the top and bottom spheres. |
Quaternion
rotation
The capsule rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if capsule overlaps any matching object, otherwise false. |
CheckConvex(Vector3, CollisionData, Vector3, Quaternion, UInt32, Boolean)
Checks whether the given convex mesh overlaps with other colliders or not.
Declaration
[Unmanaged]
public bool CheckConvex(Vector3 center, CollisionData convexMesh, Vector3 scale, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Quaternion
rotation
The convex mesh rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if convex mesh overlaps any matching object, otherwise false. |
CheckSphere(Vector3, Single, UInt32, Boolean)
Checks whether the given sphere overlaps with other colliders or not.
Declaration
[Unmanaged]
public bool CheckSphere(Vector3 center, float radius, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The sphere center. |
System.Single
radius
The radius of the sphere. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if sphere overlaps any matching object, otherwise false. |
CollectResults()
Called to collect physic simulation results and apply them as well as fire collision events.
Declaration
[Unmanaged]
public void CollectResults()
ConvexCast(Vector3, CollisionData, Vector3, Vector3, Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a convex mesh.
Declaration
[Unmanaged]
public bool ConvexCast(Vector3 center, CollisionData convexMesh, Vector3 scale, Vector3 direction, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Vector3
direction
The normalized direction in which cast a convex mesh. |
Quaternion
rotation
The convex mesh rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if convex mesh hits an matching object, otherwise false. |
ConvexCast(Vector3, CollisionData, Vector3, Vector3, out RayCastHit, Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a convex mesh.
Declaration
[Unmanaged]
public bool ConvexCast(Vector3 center, CollisionData convexMesh, Vector3 scale, Vector3 direction, out RayCastHit hitInfo, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Vector3
direction
The normalized direction in which cast a convex mesh. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if convex mesh hits an matching object, otherwise false. |
ConvexCastAll(Vector3, CollisionData, Vector3, Vector3, out RayCastHit[], Quaternion, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a convex mesh.
Declaration
[Unmanaged]
public bool ConvexCastAll(Vector3 center, CollisionData convexMesh, Vector3 scale, Vector3 direction, out RayCastHit[] results, Quaternion rotation, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Vector3
direction
The normalized direction in which cast a convex mesh. |
RayCastHit[]
results
The result hits. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if convex mesh hits an matching object, otherwise false. |
LineCast(Vector3, Vector3, out RayCastHit, UInt32, Boolean)
Performs a line between two points in the scene.
Declaration
[Unmanaged]
public bool LineCast(Vector3 start, Vector3 end, out RayCastHit hitInfo, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
start
The start position of the line. |
Vector3
end
The end position of the line. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
LineCast(Vector3, Vector3, UInt32, Boolean)
Performs a line between two points in the scene.
Declaration
[Unmanaged]
public bool LineCast(Vector3 start, Vector3 end, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
start
The start position of the line. |
Vector3
end
The end position of the line. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
LineCastAll(Vector3, Vector3, out RayCastHit[], UInt32, Boolean)
Performs a line between two points in the scene, returns all hitpoints infos.
Declaration
[Unmanaged]
public bool LineCastAll(Vector3 start, Vector3 end, out RayCastHit[] results, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
start
The origin of the ray. |
Vector3
end
The normalized direction of the ray. |
RayCastHit[]
results
The result hits. Valid only when method returns true. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
OverlapBox(Vector3, Vector3, out Collider[], Quaternion, UInt32, Boolean)
Finds all colliders touching or inside of the given box.
Declaration
[Unmanaged]
public bool OverlapBox(Vector3 center, Vector3 halfExtents, out Collider[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
Collider[]
results
The result colliders that overlap with the given box. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if box overlaps any matching object, otherwise false. |
OverlapBox(Vector3, Vector3, out PhysicsColliderActor[], Quaternion, UInt32, Boolean)
Finds all colliders touching or inside of the given box.
Declaration
[Unmanaged]
public bool OverlapBox(Vector3 center, Vector3 halfExtents, out PhysicsColliderActor[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The box center. |
Vector3
halfExtents
The half size of the box in each direction. |
PhysicsColliderActor[]
results
The result colliders that overlap with the given box. Valid only when method returns true. |
Quaternion
rotation
The box rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if box overlaps any matching object, otherwise false. |
OverlapCapsule(Vector3, Single, Single, out Collider[], Quaternion, UInt32, Boolean)
Finds all colliders touching or inside of the given capsule.
Declaration
[Unmanaged]
public bool OverlapCapsule(Vector3 center, float radius, float height, out Collider[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The capsule center. |
System.Single
radius
The radius of the capsule. |
System.Single
height
The height of the capsule, excluding the top and bottom spheres. |
Collider[]
results
The result colliders that overlap with the given capsule. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if capsule overlaps any matching object, otherwise false. |
OverlapCapsule(Vector3, Single, Single, out PhysicsColliderActor[], Quaternion, UInt32, Boolean)
Finds all colliders touching or inside of the given capsule.
Declaration
[Unmanaged]
public bool OverlapCapsule(Vector3 center, float radius, float height, out PhysicsColliderActor[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The capsule center. |
System.Single
radius
The radius of the capsule. |
System.Single
height
The height of the capsule, excluding the top and bottom spheres. |
PhysicsColliderActor[]
results
The result colliders that overlap with the given capsule. Valid only when method returns true. |
Quaternion
rotation
The capsule rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if capsule overlaps any matching object, otherwise false. |
OverlapConvex(Vector3, CollisionData, Vector3, out Collider[], Quaternion, UInt32, Boolean)
Finds all colliders touching or inside of the given convex mesh.
Declaration
[Unmanaged]
public bool OverlapConvex(Vector3 center, CollisionData convexMesh, Vector3 scale, out Collider[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
Collider[]
results
The result colliders that overlap with the given convex mesh. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if convex mesh overlaps any matching object, otherwise false. |
OverlapConvex(Vector3, CollisionData, Vector3, out PhysicsColliderActor[], Quaternion, UInt32, Boolean)
Finds all colliders touching or inside of the given convex mesh.
Declaration
[Unmanaged]
public bool OverlapConvex(Vector3 center, CollisionData convexMesh, Vector3 scale, out PhysicsColliderActor[] results, Quaternion rotation, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The convex mesh center. |
CollisionData
convexMesh
Collision data of the convex mesh. |
Vector3
scale
The scale of the convex mesh. |
PhysicsColliderActor[]
results
The result colliders that overlap with the given convex mesh. Valid only when method returns true. |
Quaternion
rotation
The convex mesh rotation. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if convex mesh overlaps any matching object, otherwise false. |
OverlapSphere(Vector3, Single, out Collider[], UInt32, Boolean)
Finds all colliders touching or inside of the given sphere.
Declaration
[Unmanaged]
public bool OverlapSphere(Vector3 center, float radius, out Collider[] results, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The sphere center. |
System.Single
radius
The radius of the sphere. |
Collider[]
results
The result colliders that overlap with the given sphere. Valid only when method returns true. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if sphere overlaps any matching object, otherwise false. |
OverlapSphere(Vector3, Single, out PhysicsColliderActor[], UInt32, Boolean)
Finds all colliders touching or inside of the given sphere.
Declaration
[Unmanaged]
public bool OverlapSphere(Vector3 center, float radius, out PhysicsColliderActor[] results, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The sphere center. |
System.Single
radius
The radius of the sphere. |
PhysicsColliderActor[]
results
The result colliders that overlap with the given sphere. Valid only when method returns true. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if sphere overlaps any matching object, otherwise false. |
RayCast(Vector3, Vector3, out RayCastHit, Single, UInt32, Boolean)
Performs a raycast against objects in the scene, returns results in a RayCastHit structure.
Declaration
[Unmanaged]
public bool RayCast(Vector3 origin, Vector3 direction, out RayCastHit hitInfo, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
origin
The origin of the ray. |
Vector3
direction
The normalized direction of the ray. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
RayCast(Vector3, Vector3, Single, UInt32, Boolean)
Performs a raycast against objects in the scene.
Declaration
[Unmanaged]
public bool RayCast(Vector3 origin, Vector3 direction, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
origin
The origin of the ray. |
Vector3
direction
The normalized direction of the ray. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
RayCastAll(Vector3, Vector3, out RayCastHit[], Single, UInt32, Boolean)
Performs a raycast against objects in the scene, returns results in a RayCastHit structure.
Declaration
[Unmanaged]
public bool RayCastAll(Vector3 origin, Vector3 direction, out RayCastHit[] results, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
origin
The origin of the ray. |
Vector3
direction
The normalized direction of the ray. |
RayCastHit[]
results
The result hits. Valid only when method returns true. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if ray hits an matching object, otherwise false. |
Simulate(Single)
Called during main engine loop to start physic simulation. Use CollectResults after.
Declaration
[Unmanaged]
public void Simulate(float dt)
Parameters
System.Single
dt
The delta time (in seconds). |
SphereCast(Vector3, Single, Vector3, out RayCastHit, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a sphere geometry.
Declaration
[Unmanaged]
public bool SphereCast(Vector3 center, float radius, Vector3 direction, out RayCastHit hitInfo, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The sphere center. |
System.Single
radius
The radius of the sphere. |
Vector3
direction
The normalized direction in which cast a sphere. |
RayCastHit
hitInfo
The result hit information. Valid only when method returns true. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if sphere hits an matching object, otherwise false. |
SphereCast(Vector3, Single, Vector3, Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a sphere geometry.
Declaration
[Unmanaged]
public bool SphereCast(Vector3 center, float radius, Vector3 direction, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The sphere center. |
System.Single
radius
The radius of the sphere. |
Vector3
direction
The normalized direction in which cast a sphere. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if sphere hits an matching object, otherwise false. |
SphereCastAll(Vector3, Single, Vector3, out RayCastHit[], Single, UInt32, Boolean)
Performs a sweep test against objects in the scene using a sphere geometry.
Declaration
[Unmanaged]
public bool SphereCastAll(Vector3 center, float radius, Vector3 direction, out RayCastHit[] results, float maxDistance = 3.40282347E+38F, uint layerMask = 4294967295U, bool hitTriggers = true)
Parameters
Vector3
center
The sphere center. |
System.Single
radius
The radius of the sphere. |
Vector3
direction
The normalized direction in which cast a sphere. |
RayCastHit[]
results
The result hits. Valid only when method returns true. |
System.Single
maxDistance
The maximum distance the ray should check for collisions. |
System.UInt32
layerMask
The layer mask used to filter the results. |
System.Boolean
hitTriggers
If set to |
Returns
System.Boolean
True if sphere hits an matching object, otherwise false. |