Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


PhysicsQuery.WorldCastMode

Controls what results are returned from a cast query against the PhysicsWorld.
Read time 1 minuteLast updated 14 days ago

Definition

public enum PhysicsQuery.WorldCastMode

Examples

// Cast a circle and return every hit, sorted by ascending distance.using UnityEngine;using Unity.Collections;using Unity.U2D.Physics;public class WorldCastModeExample : MonoBehaviour{ void Start() { PhysicsWorld world = PhysicsWorld.defaultWorld; CircleGeometry geometry = new CircleGeometry { radius = 0.5f }; Vector2 translation = new Vector2(0f, -10f); PhysicsQuery.QueryFilter filter = new PhysicsQuery.QueryFilter(); using NativeArray<PhysicsQuery.WorldCastResult> results = world.CastGeometry(geometry, translation, filter, PhysicsQuery.WorldCastMode.AllSorted, Allocator.Temp); }}

Fields

Value

Description

AllReturn all the hits.
AllSortedReturn all the hits but also sort by ascending distance (closest first).
ClosestReturn only the closest hit.