Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PhysicsScene2D

Represents a single instance of a 2D physics Scene.
Read time 2 minutesLast updated 4 days ago

Definition

public struct PhysicsScene2D : IEquatable<PhysicsScene2D>

Remarks

A 2D physics Scene owns all 2D physics component objects added to it and can perform a simulation of them as well as execute queries against them. All of this functionality is isolated from any other physics Scene. Using this, multiple independent physics Scenes can coexist.

Properties

Property

Description

subStepCountThe number of simulation sub-steps that occurred during the last simulation step.
subStepLostTimeThe amount of simulation time that has been "lost" due to simulation sub-stepping hitting the maximum number of allowed sub-steps.

Methods

Method

Description

BoxCastCasts a box against colliders in the PhysicsScene2D, returning the first intersection only.
CapsuleCastCasts a capsule against colliders in the PhysicsScene2D, returning the first intersection only.
CircleCastCasts a circle against colliders in the PhysicsScene2D, returning the first intersection only.
GetRayIntersectionCast a 3D ray against the 2D Colliders in the Scene.
IsEmptyDetermines whether the physics Scene is empty or not.
IsValidDetermines whether the physics Scene is valid or not.
LinecastCasts a line segment against colliders in the PhysicsScene2D, returning the first intersection only.
OverlapAreaChecks an area (non-rotated box) against Colliders in the PhysicsScene2D, returning the first intersection only.
OverlapBoxChecks a box against Colliders in the PhysicsScene2D, returning the first intersection only.
OverlapCapsuleChecks a capsule against Colliders in the PhysicsScene2D, returning the first intersection only.
OverlapCircleChecks a circle against Colliders in the PhysicsScene2D, returning the first intersection only.
OverlapPointChecks a point against Colliders in the PhysicsScene2D, returning the first intersection only.
RaycastCasts a ray against colliders in the PhysicsScene2D, returning the first intersection only.
SimulateSimulate physics associated with this PhysicsScene2D.

Static Methods

Method

Description

OverlapColliderChecks a Collider against Colliders in the PhysicsScene2D, returning all intersections.