Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


RaycastCommand

Create a RaycastCommand.
Read time 2 minutesLast updated 5 days ago

Definition

  • Type: Constructor
  • Namespace: UnityEngine
  • Assembly: UnityEngine.PhysicsModule

RaycastCommand(Vector3, Vector3, QueryParameters, float)

Create a RaycastCommand.
public RaycastCommand(Vector3 from, Vector3 direction, QueryParameters queryParameters, float distance = 3.4028235E+38)

Parameters

The starting point of the ray in world coordinates.

direction

The direction of the ray.

queryParameters

Structure for specifying additional parameters for a batch query such as layer mask, hit multiple mesh faces, hit triggers and hit backfaces.

distance

The maximum distance the ray should check for collisions.

Remarks

The query is run in the default physics scene.

RaycastCommand(PhysicsScene, Vector3, Vector3, QueryParameters, float)

Create a RaycastCommand.
public RaycastCommand(PhysicsScene physicsScene, Vector3 from, Vector3 direction, QueryParameters queryParameters, float distance = 3.4028235E+38)

Parameters

physicsScene

The physics scene to run the raycast query in.

The starting point of the ray in world coordinates.

direction

The direction of the ray.

queryParameters

Structure for specifying additional parameters for a batch query such as layer mask, hit multiple mesh faces, hit triggers and hit backfaces.

distance

The maximum distance the ray should check for collisions.

RaycastCommand(Vector3, Vector3, float, int, int)

Create a RaycastCommand.
Warning
Deprecated. This struct signature is no longer supported. Use struct with a QueryParameters instead
public RaycastCommand(Vector3 from, Vector3 direction, float distance = 3.4028235E+38, int layerMask = -5, int maxHits = 1)

Parameters

The starting point of the ray in world coordinates.

direction

The direction of the ray.

distance

The maximum distance the ray should check for collisions.

layerMask

A LayerMask that is used to selectively ignore Colliders when casting a ray.

maxHits

The maximum number of Colliders the ray can hit.

Remarks

The query is run in the default physics scene.

RaycastCommand(PhysicsScene, Vector3, Vector3, float, int, int)

Create a RaycastCommand.
Warning
Deprecated. This struct signature is no longer supported. Use struct with a QueryParameters instead
public RaycastCommand(PhysicsScene physicsScene, Vector3 from, Vector3 direction, float distance = 3.4028235E+38, int layerMask = -5, int maxHits = 1)

Parameters

physicsScene

The physics scene to run the raycast query in.

The starting point of the ray in world coordinates.

direction

The direction of the ray.

distance

The maximum distance the ray should check for collisions.

layerMask

A LayerMask that is used to selectively ignore Colliders when casting a ray.

maxHits

The maximum number of Colliders the ray can hit.