Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PhysicsQuery

Various physics queries.
Read time 2 minutesLast updated 5 days ago

Definition

  • Type: Struct
  • Namespace: Unity.U2D.Physics
  • Assembly: UnityEngine.PhysicsCore2DModule
public readonly struct PhysicsQuery

Static Methods

Method

Description

CapsuleAndCapsuleCheck the intersection between Capsule and Capsule geometries.
CapsuleAndCircleCheck the intersection between Capsule and Circle geometries.
CastShapesCast two shape proxies against each other. Initially touching shapes are treated as a miss. You should check for overlap first if initial overlap is required.
ChainSegmentAndCapsuleCheck the intersection between ChainSegment and Capsule geometries.
ChainSegmentAndCircleCheck the intersection between ChainSegment and Circle geometries.
ChainSegmentAndPolygonCheck the intersection between ChainSegment and Polygon geometries.
CircleAndCircleCheck the intersection between Circle and Circle geometries.
PolygonAndCapsuleCheck the intersection between Polygon and Capsule geometries.
PolygonAndCircleCheck the intersection between Polygon and Circle geometries.
PolygonAndPolygonCheck the intersection between Polygon and Polygon geometries.
SegmentAndCapsuleCheck the intersection between Segment and Capsule geometries.
SegmentAndCircleCheck the intersection between Segment and Circle geometries.
SegmentAndPolygonCheck the intersection between Segment and Polygon geometries.
SegmentDistanceCalculate the distance and closest points between two segments.
ShapeAndShapeCheck the intersection between two shapes (PhysicsShape).
ShapeDistanceCalculate the distance and closest points between two shape proxies.
ShapeTimeOfImpactCalculate the upper bound on time before two shape proxies penetrate i.e. the time-of-impact. Time is represented as a fraction in the range [0, maxInterval]. This uses a swept separating axis and may miss some intermediate, non-tunneling collisions.

Structs

Struct

Description

PhysicsQuery.CastRayInputCast-Ray arguments used by CastRay queries.
PhysicsQuery.CastResultCast result when performing cast-ray or cast-shape queries against geometry.
PhysicsQuery.CastShapeInputCast shape arguments used by CastShape queries. To use existing shape geometries, use the helper constructors that allow creation via a specific shape geometry type.
PhysicsQuery.CastShapePairInputCast two shape proxies against each other. To use existing shape geometries, use the helper constructors that allow creation via a specific shape geometry type.
PhysicsQuery.DistanceInputAn input used for shape distance queries.
PhysicsQuery.DistanceResultDistance result from shape distance queries.
PhysicsQuery.QueryFilterA query filter is used to filter query results known as "hits". For example, you may want a ray-cast representing a projectile to hit players and the static environment but not debris.
PhysicsQuery.SegmentDistanceResultSegment distance result from segment distance queries.
PhysicsQuery.ShapeSweepDescribes the motion of a shape for a time-of-impact calculation. The shape is defined with respect to the body origin.
PhysicsQuery.TimeOfImpactInputThe input for time-of-impact query.
PhysicsQuery.TimeOfImpactResultTime-of-impact result from time-of-impact query.
PhysicsQuery.WorldCastResultThe results from performing any Cast query against the PhysicsWorld.
PhysicsQuery.WorldMoverInputThe world mover arguments used by the world mover.
PhysicsQuery.WorldMoverResultThe world mover result used by the world mover.
PhysicsQuery.WorldOverlapResultThe results from performing any Overlap query.

Enums

Enum

Description

PhysicsQuery.WorldCastModeControls what results are returned from a cast query against the PhysicsWorld.