https://github.com/vrlabs/raycast-prefab
Cast an object onto collider surfaces.
https://github.com/vrlabs/raycast-prefab
Last synced: 3 months ago
JSON representation
Cast an object onto collider surfaces.
- Host: GitHub
- URL: https://github.com/vrlabs/raycast-prefab
- Owner: VRLabs
- License: mit
- Created: 2021-12-21T12:52:53.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-15T10:04:58.000Z (over 1 year ago)
- Last Synced: 2025-04-05T20:35:13.537Z (about 1 year ago)
- Language: C#
- Homepage:
- Size: 14.4 MB
- Stars: 9
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Raycast Prefab
[](https://github.com/VRLabs/Raycast-Prefab/releases/latest)
[](https://github.com/VRLabs/Raycast-Prefab/blob/main/LICENSE)
[](https://img.shields.io/badge/Quest-Incompatible-red?logo=Meta)
[](https://unity.com/releases/editor/whats-new/2022.3.22)
[](https://vrchat.com/home/download)
[](https://discord.vrlabs.dev/)
[](https://patreon.vrlabs.dev/)
Places an object at the hit point of a raycast

### ⬇️ [Download Latest Version](https://github.com/VRLabs/Raycast-Prefab/releases/latest)
### 📦 [Add to VRChat Creator Companion](https://vrlabs.dev/packages?package=dev.vrlabs.raycast-prefab)
---
## How it works
* [Limb IK](http://www.root-motion.com/finalikdox/html/page12.html) hierarchy is used with a [Grounder](http://www.root-motion.com/finalikdox/html/page9.html) to cast an object onto collider surfaces.
## Install Guide
https://github.com/VRLabs/Raycast-Prefab/assets/76777936/b97b4dd0-0615-430b-9f10-9a4c40f94d43
* If you dont already have [Final IK](https://assetstore.unity.com/packages/tools/animation/final-ik-14290) installed, download and install the [Final IK Stub](https://github.com/VRLabs/Final-IK-Stub).
* Note: Testing in Unity is not possible when using the Final IK Stub!
* Drag & drop the ``Raycast`` prefab into the base of your Hierarchy.
* Right click and unpack the prefab, then drag & drop it onto your avatar.
* By default, the raycast aims down from the ``Casting Target`` object.
* If needed, you can move and rotate the ``Casting Target`` object until it "aims" at your target.
## How to Use
* Place the objects you want to raycast under the ``Container`` GameObject or constrain them to the ``Container`` GameObject.
* World Particles can't be Constrained to the ``Container`` GameObject and have to be parented to the ``Container`` object instead due to "Fix Transforms" affecting the emission location.
* In game, the ``Container`` object will raycast down from the ``Casting Target`` onto any Collider which matches the Layers set up in the ``Grounder``'s Grounder IK Script (by default this is: ``Default``, ``Ignore Raycat``, ``Water`` and ``Environment``).
* Note that you can't change layers on your avatar. Local avatar layers will always be ``PlayerLocal`` and ``MirrorReflection``, and remote avatar layers will always be ``Player`` (with the exception of UIMenu).
## Additional notes
* VRChat uses Final IK v1.9. If you are using a different version you may experience differences in behavior when testing with Final IK.
## Performance stats
```c++
Constraints: 2
Constraint Depth: 2
Colliders: 1
```
## Hierarchy layout
```html
Raycast
|-Container
| |-Cube
| |-Cube
|-IK
| |-Grounder
| | |-Offset
| | | |-End
|-Floor
|-Casting Target
```
## Contributors
* [lin](https://github.com/oofdesu)
## License
Raycast Prefab is available as-is under MIT. For more information see [LICENSE](https://github.com/VRLabs/Raycast-Prefab/blob/main/LICENSE).
[
](https://vrlabs.dev "VRLabs")
[
](https://discord.vrlabs.dev/ "VRLabs")
[
](https://patreon.vrlabs.dev/ "VRLabs")
[
](https://twitter.com/vrlabsdev "VRLabs")