Edit

Share via


ConeCastUtility.ConeCastBest Method

Definition

Function casts a sphere along a ray and checks if the hitpoint is within the angle of the cone and returns the best target determined by the weights provided.

public:
 static UnityEngine::RaycastHit ConeCastBest(UnityEngine::Vector3 origin, UnityEngine::Vector3 direction, float maxRadius, float maxDistance, float coneAngle, UnityEngine::LayerMask layerMask, float distanceWeight, float angleWeight, float distanceToCenterWeight, float angleToCenterWeight);
public static UnityEngine.RaycastHit ConeCastBest (UnityEngine.Vector3 origin, UnityEngine.Vector3 direction, float maxRadius, float maxDistance, float coneAngle, UnityEngine.LayerMask layerMask, float distanceWeight, float angleWeight, float distanceToCenterWeight, float angleToCenterWeight);
static member ConeCastBest : UnityEngine.Vector3 * UnityEngine.Vector3 * single * single * single * UnityEngine.LayerMask * single * single * single * single -> UnityEngine.RaycastHit
Public Shared Function ConeCastBest (origin As Vector3, direction As Vector3, maxRadius As Single, maxDistance As Single, coneAngle As Single, layerMask As LayerMask, distanceWeight As Single, angleWeight As Single, distanceToCenterWeight As Single, angleToCenterWeight As Single) As RaycastHit

Parameters

origin
UnityEngine.Vector3

The vertex of the cone and the at the start of the sweep.

direction
UnityEngine.Vector3

The direction into which to sweep the sphere..

maxRadius
Single

The radius of the sweep.

maxDistance
Single

The max length of the cast.

coneAngle
Single

The angle used to define the cone.

layerMask
UnityEngine.LayerMask

A Layer mask that is used to selectively ignore colliders when casting a capsule.

distanceWeight
Single

The importance of distance between the hitpoint and the origin in selecting the best target.

angleWeight
Single

The importance of angle between the hitpoint and the origin in selecting the best target.

distanceToCenterWeight
Single

The importance of distance between the hitpoint and the center of the object in selecting the best target.

angleToCenterWeight
Single

The importance of angle between the hitpoint and the center of the object in selecting the best target.

Returns

UnityEngine.RaycastHit

The RaycastHit of the best object.

Applies to