Raycast
The VRCRaycast component in VRChat allow avatars to fire rays through the scene that hit against colliders in the world or against players. A transform is positioned at the point the raycast hits.
Component Properties

| Property | Description | |
|---|---|---|
| Raycast Direction | The direction to cast the ray in. This is applied in local space, so it will be affected by the rotation of the transform. | |
| Distance | The maximum distance the raycast is able to travel. If you set this to zero, the raycast will travel as far as possible (1000 units). | |
| Collision Mode | Controls the layers this raycast component will collide against: You can have it collide against layers used in worlds, layers used on player colliders, or both at once. You can also manually define the specific layers to collide with for advanced use cases. | |
| Hit Worlds | The ray will collide with the Default and Environment layers as well as all of the user controlled layers. (Default) | |
| Hit Players | The ray will collide with Player and PlayerLocal layers. | |
| Hit Worlds And Players | The ray will collide with both worlds and players, combining the layers of the two options above. | |
| Hit Custom Layers | The ray will collide with a set of layers that you manually specify. | |
| Custom Collision Layers | The custom set of layers to use when Collision Mode is set to Hit Custom Layers. This property is hidden when not using custom layers. | |
| Result Transform | The transform that will be moved and optionally rotated to match the collision point of the raycast. A Result Transform must be assigned for this component to be of any use. | |
| Apply Rotation | By default, the Result Transform will only have its position changed. If Apply Rotation is enabled, it will also be rotated so its positive Z axis points away from the surface that was hit (the collision normal). | |
| Alignment Axis | When applying rotation to the result transform, this controls which axis will be aligned with the surface that was hit. | |
| Disable On Miss | If this property is enabled, the Result Transform's game object will be automatically disabled when the ray is not colliding against anything, and will be re-enabled once it starts colliding with something again. | |
| Positioning On Miss | Controls how this raycast component should behave if it doesn't hit anything: | |
| Do Nothing | Does nothing to the Result Transform. (Default) | |
| Snap To Start | Moves the Result Transform to be at the start point of the ray. | |
| Snap To End | Moves the Result Transform to be at the end point of the ray. |
warning
There is an upper limit of 80 VRCRaycast components for avatars.
For compatibility reasons, this limit is shared with FinalIK components, which should generally not be used in situations where VRCRaycast is enough to meet your needs.
Usage Tips
- Raycasts are limited to a maximum distance of 1000 units.
- Do not use the transform a
VRCRaycastcomponent is attached to or any of its parents as its own result transform. Doing this can cause unpredictable behavior as the raycast component is moved around by its own result. - When gizmos are enabled, a blue line is drawn in the scene view in avatar projects while a
VRCRaycastcomponent is selected to show where the raycast will go. You can also enter play mode in avatar projects to test the behavior of your raycast without building your avatar.