Raycasts
Provides client raycasting functionality.
Functions
Section titled “Functions”GetRaycastDirection
Section titled “GetRaycastDirection”Gets the direction for a raycast, given a camera direction and spread value.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
direction | Vector3 | The initial camera direction. | |
spread | number | The spread value. |
Returns
Section titled “Returns”Vector3
DeriveTargetPosition
Section titled “DeriveTargetPosition”Determines the target position where a ray would land if it does not hit anything.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
origin | Vector3 | The origin. | |
direction | Vector3 | The direction. | |
range | number | The range. |
Returns
Section titled “Returns”Vector3
GetDefaultRaycastParams
Section titled “GetDefaultRaycastParams”Returns the default RaycastParams that should be used for item raycasts.
Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
...ignore | ...Instance | Instances to ignore. This is a var arg so you may specify multiple instances. |
Returns
Section titled “Returns”RaycastParams
GetOrigin
Section titled “GetOrigin”Returns the origin to use for an action.
Returns
Section titled “Returns”Vector3
GetDirection
Section titled “GetDirection”Returns the direction, without spread, to use for an action.
Returns
Section titled “Returns”Vector3
Hitscan
Section titled “Hitscan”Parameters
Section titled “Parameters”| Name | Type | Default | Description |
|---|---|---|---|
params | RaycastParams | The RaycastParams to use. | |
origin | Vector3 | The origin. | |
direction | Vector3 | The direction, adjusted for spread. | |
range | number | The range. | |
checkInitialOverlap | boolean? | If true, the origin volume will be checked for hits. Typically used for melee weapons. | |
fallbackToBlockcast | boolean? | If true, a blockcast will be used if no hit is found by a raycast. Typically used for melee weapons. |
Returns
Section titled “Returns”BehaviourTypes.HitscanResult