CapsuleCollider.Raycast(Ray ray, number maxDistance)
Casts a Ray that ignores all Colliders except this one.
Parameters:
Name | Type | Description |
---|---|---|
ray | Ray | The starting point and direction of the ray. |
maxDistance | number | The max length of the ray. |
Returns:
type | Description |
---|---|
boolean | True when the ray intersects the collider, otherwise false. |
RaycastHit | If true is returned, hitInfo will contain more information about where the collider was hit. |
Usage
---@type CapsuleCollider
local capsulecollider;
---@type Ray
local ray;
---@type number
local maxDistance;
local val0, val1 = capsulecollider.Raycast(ray, maxDistance)
Example
local didHit, hitInfo = someCollider.Raycast(Ray(Vector3.zero, Vector3.forward), 50);