Based on World Constraint.
It uses VRCFury for fast installation.
- Install the latest package
- Install VRCFury
- Drag and drop "Smart Floor Collider" onto the root of your avatar.
Note
You must remove or move the old floor collider to the "collider" game object under the World Constraint. (If you are reparenting your floor collider under the collider game object, remove the physbone collider component from "collider".
- VRFury should handle the rest. Click upload, and you are done.
This works nearly identical to how world constraints normally work with a key few changes for this to work for this.
The first change is that the "World Constraint" only locks on the Y axis. Changing the Freeze Position Axis to only lock the Y axis allows the root parent constraint to follow us still around when it's holding an object in place.
As a result, when you turn off the child "Container" parent constraint, the object will stay in line with the avatar center but freeze in its last Y-axis position.
For the FX Controller, to detect whether the user is on the ground, we use the Global Parameter "Grounded," when the user is not grounded, the "Container" parent constraint is disabled which causes the floor collider to instantly stop moving as soon as VRChat detects the local client is not on the ground. As soon as the avatar returns to the ground with Grounded = True, the "Container" parent constraint is enabled again.
There is also a detection of whether the local client falls with VelocityY. An issue with freezing the floor collider in place is being able to fall through it. The falling state aims to detect when the user is not Grounded and if VelocityY is less than -2. This turns off the floor collider.
//todo