class
PhysicsScene
Physical representation of a scene, allowing creation of new physical objects in the scene and queries against those objects.
Objects created in different scenes cannot physically interact with eachother.
Public
Methods
FixedUpdate
Updates the physics simulation.
In order to maintain stability of the physics calculations this method should be called at fixed intervals (e.g. 60 times a second).
- step
- Time delta to advance the physics simulation by, in seconds.
Update
Performs any physics operations that arent tied to the fixed update interval.
Should be called once per frame.
SetPaused
Pauses or resumes the physics simulation.
IsUpdateInProgress
Checks is the physics simulation update currently in progress.
RayCast
Casts a ray into the scene and returns the closest found hit, if any.
- ray
- Ray to cast into the scene.
- hit
- Information recorded about a hit. Only valid if method returns true.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
RayCast
Casts a ray into the scene and returns the closest found hit, if any.
- origin
- Origin of the ray to cast into the scene.
- unitDir
- Unit direction of the ray to cast into the scene.
- hit
- Information recorded about a hit. Only valid if method returns true.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
BoxCast
Performs a sweep into the scene using a box and returns the closest found hit, if any.
- box
- Box to sweep through the scene.
- rotation
- Orientation of the box.
- unitDir
- Unit direction towards which to perform the sweep.
- hit
- Information recorded about a hit. Only valid if method returns true.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
SphereCast
Performs a sweep into the scene using a sphere and returns the closest found hit, if any.
- sphere
- Sphere to sweep through the scene.
- unitDir
- Unit direction towards which to perform the sweep.
- hit
- Information recorded about a hit. Only valid if method returns true.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
CapsuleCast
Performs a sweep into the scene using a capsule and returns the closest found hit, if any.
- capsule
- Capsule to sweep through the scene.
- rotation
- Orientation of the capsule.
- unitDir
- Unit direction towards which to perform the sweep.
- hit
- Information recorded about a hit. Only valid if method returns true.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
ConvexCast
Performs a sweep into the scene using a convex mesh and returns the closest found hit, if any.
- mesh
- Mesh to sweep through the scene. Must be convex.
- position
- Starting position of the mesh.
- rotation
- Orientation of the mesh.
- unitDir
- Unit direction towards which to perform the sweep.
- hit
- Information recorded about a hit. Only valid if method returns true.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
RayCastAll
Casts a ray into the scene and returns all found hits.
- ray
- Ray to cast into the scene.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: List of all detected hits.
RayCastAll
Casts a ray into the scene and returns all found hits.
- origin
- Origin of the ray to cast into the scene.
- unitDir
- Unit direction of the ray to cast into the scene.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: List of all detected hits.
BoxCastAll
Performs a sweep into the scene using a box and returns all found hits.
- box
- Box to sweep through the scene.
- rotation
- Orientation of the box.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: List of all detected hits.
SphereCastAll
Performs a sweep into the scene using a sphere and returns all found hits.
- sphere
- Sphere to sweep through the scene.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: List of all detected hits.
CapsuleCastAll
Performs a sweep into the scene using a capsule and returns all found hits.
- capsule
- Capsule to sweep through the scene.
- rotation
- Orientation of the capsule.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: List of all detected hits.
ConvexCastAll
Performs a sweep into the scene using a convex mesh and returns all found hits.
- mesh
- Mesh to sweep through the scene. Must be convex.
- position
- Starting position of the mesh.
- rotation
- Orientation of the mesh.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: List of all detected hits.
RayCastAny
Casts a ray into the scene and checks if it has hit anything.
This can be significantly more efficient than other types of cast* calls.
- ray
- Ray to cast into the scene.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
RayCastAny
Casts a ray into the scene and checks if it has hit anything.
This can be significantly more efficient than other types of cast* calls.
- origin
- Origin of the ray to cast into the scene.
- unitDir
- Unit direction of the ray to cast into the scene.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
BoxCastAny
Performs a sweep into the scene using a box and checks if it has hit anything.
This can be significantly more efficient than other types of cast* calls.
- box
- Box to sweep through the scene.
- rotation
- Orientation of the box.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
SphereCastAny
Performs a sweep into the scene using a sphere and checks if it has hit anything.
This can be significantly more efficient than other types of cast* calls.
- sphere
- Sphere to sweep through the scene.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
CapsuleCastAny
Performs a sweep into the scene using a capsule and checks if it has hit anything.
This can be significantly more efficient than other types of cast* calls.
- capsule
- Capsule to sweep through the scene.
- rotation
- Orientation of the capsule.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
ConvexCastAny
Performs a sweep into the scene using a convex mesh and checks if it has hit anything.
This can be significantly more efficient than other types of cast* calls.
- mesh
- Mesh to sweep through the scene. Must be convex.
- position
- Starting position of the mesh.
- rotation
- Orientation of the mesh.
- unitDir
- Unit direction towards which to perform the sweep.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
- max
- Maximum distance at which to perform the query. Hits past this distance will not be detected.
Returns: True if something was hit, false otherwise.
BoxOverlap
Returns a list of all colliders in the scene that overlap the provided box.
- box
- Box to check for overlap.
- rotation
- Orientation of the box.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the box.
SphereOverlap
Returns a list of all colliders in the scene that overlap the provided sphere.
- sphere
- Sphere to check for overlap.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the sphere.
CapsuleOverlap
Returns a list of all colliders in the scene that overlap the provided capsule.
- capsule
- Capsule to check for overlap.
- rotation
- Orientation of the capsule.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the capsule.
ConvexOverlap
Returns a list of all colliders in the scene that overlap the provided convex mesh.
- mesh
- Mesh to check for overlap. Must be convex.
- position
- Position of the mesh.
- rotation
- Orientation of the mesh.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the mesh.
BoxOverlapAny
Checks if the provided box overlaps any other collider in the scene.
- box
- Box to check for overlap.
- rotation
- Orientation of the box.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: True if there is overlap with another object, false otherwise.
SphereOverlapAny
Checks if the provided sphere overlaps any other collider in the scene.
- sphere
- Sphere to check for overlap.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: True if there is overlap with another object, false otherwise.
CapsuleOverlapAny
Checks if the provided capsule overlaps any other collider in the scene.
- capsule
- Capsule to check for overlap.
- rotation
- Orientation of the capsule.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: True if there is overlap with another object, false otherwise.
ConvexOverlapAny
Checks if the provided convex mesh overlaps any other collider in the scene.
- mesh
- Mesh to check for overlap. Must be convex.
- position
- Position of the mesh.
- rotation
- Orientation of the mesh.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: True if there is overlap with another object, false otherwise.
HasFlag
Checks is a specific physics option enabled.
SetFlag
Enables or disabled a specific physics option.
GetMaxTesselationEdgeLength
Returns a maximum edge length before a triangle is tesselated.
SetMaxTesselationEdgeLength
Sets a maximum edge length before a triangle is tesselated.
GetGravity
SetGravity
Determines the global gravity value for all objects in the scene.
AddBroadPhaseRegion
Adds a new physics region.
Certain physics options require you to set up regions in which physics objects are allowed to be in, and objects outside of these regions will not be handled by physics. You do not need to set up these regions by default.
RemoveBroadPhaseRegion
Removes a physics region.
ClearBroadPhaseRegions
Removes all physics regions.
Internal
Methods
CreateFixedJoint
Creates a new fixed joint.
CreateDistanceJoint
Creates a new distance joint.
CreateHingeJoint
Creates a new hinge joint.
CreateSphericalJoint
Creates a new spherical joint.
CreateSliderJoint
Creates a new spherical joint.
CreateD6Joint
Creates a new D6 joint.
CreateCharacterController
Creates a new character controller.
BoxOverlapInternal
Returns a list of all colliders in the scene that overlap the provided box.
- box
- Box to check for overlap.
- rotation
- Orientation of the box.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the box.
SphereOverlapInternal
Returns a list of all colliders in the scene that overlap the provided sphere.
- sphere
- Sphere to check for overlap.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the sphere.
CapsuleOverlapInternal
Returns a list of all colliders in the scene that overlap the provided capsule.
- capsule
- Capsule to check for overlap.
- rotation
- Orientation of the capsule.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the capsule.
ConvexOverlapInternal
Returns a list of all colliders in the scene that overlap the provided convex mesh.
- mesh
- Mesh to check for overlap. Must be convex.
- position
- Position of the mesh.
- rotation
- Orientation of the mesh.
- layer
- Layers to consider for the query. This allows you to ignore certain groups of objects.
Returns: List of all colliders that overlap the mesh.