You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(Presence): add step height support to body physics
The Body Physics script now supports a step offset height to determine
if a collided object is small enough to be climbed upon even if the
object is too high for the capsule collider to naturally resolve the
collision to the new height.
This is achieved with a sub capsule collider that sits below the main
collider and acts as a foot collider to detect when any objects are
collided with and then a box is cast down to see if the main body
collider should be standing on a new surface.
If the box cast is valid then the play area is either teleported to
the new position if a teleporter is available or the play area is just
snapped to the new position if no teleporter is available.
[Tooltip("The `y` distance between the headset and the object being leaned over, if object being leaned over is taller than this threshold then the current standing position won't be updated.")]
72
72
publicfloatleanYThreshold=0.5f;
73
73
74
+
[Header("Step Settings")]
75
+
76
+
[Tooltip("The maximum height to consider when checking if an object can be stepped upon to.")]
77
+
publicfloatstepUpYOffset=0.15f;
78
+
[Tooltip("The width/depth of the foot collider in relation to the radius of the body collider.")]
79
+
[Range(0.1f,0.9f)]
80
+
publicfloatstepThicknessMultiplier=0.5f;
81
+
[Tooltip("The distance between the current play area Y position and the new stepped up Y position to consider a valid step up. A higher number can help with juddering on slopes or small increases in collider heights.")]
82
+
publicfloatstepDropThreshold=0.08f;
83
+
74
84
[Header("Snap To Floor Settings")]
75
85
76
86
[Tooltip("A custom raycaster to use when raycasting to find floors.")]
@@ -118,7 +128,9 @@ public enum FallingRestrictors
118
128
protectedTransformplayArea;
119
129
protectedTransformheadset;
120
130
protectedRigidbodybodyRigidbody;
131
+
protectedGameObjectbodyColliderContainer;
121
132
protectedCapsuleColliderbodyCollider;
133
+
protectedCapsuleColliderfootCollider;
122
134
protectedVRTK_CollisionTrackercollisionTracker;
123
135
protectedboolcurrentBodyCollisionsSetting;
124
136
protectedGameObjectcurrentCollidingObject=null;
@@ -145,6 +157,8 @@ public enum FallingRestrictors
Copy file name to clipboardExpand all lines: DOCUMENTATION.md
+3Lines changed: 3 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4705,6 +4705,9 @@ To allow for peeking over a ledge and not falling, a fall restiction can happen
4705
4705
* **Movement Threshold:** The amount of movement of the headset between the headset's current position and the current standing position to determine if the user is walking in play space and to ignore the body physics collisions if the movement delta is above this threshold.
4706
4706
* **Standing History Samples:** The maximum number of samples to collect of headset position before determining if the current standing position within the play space has changed.
4707
4707
* **Lean Y Threshold:** The `y` distance between the headset and the object being leaned over, if object being leaned over is taller than this threshold then the current standing position won't be updated.
4708
+
* **Step Up Y Offset:** The maximum height to consider when checking if an object can be stepped upon to.
4709
+
* **Step Thickness Multiplier:** The width/depth of the foot collider in relation to the radius of the body collider.
4710
+
* **Step Drop Threshold:** The distance between the current play area Y position and the new stepped up Y position to consider a valid step up. A higher number can help with juddering on slopes or small increases in collider heights.
4708
4711
* **Custom Raycast:** A custom raycaster to use when raycasting to find floors.
4709
4712
* **Fall Restriction:** A check to see if the drop to nearest floor should take place. If the selected restrictor is still over the current floor then the drop to nearest floor will not occur. Works well for being able to lean over ledges and look down. Only works for falling down not teleporting up.
4710
4713
* **Gravity Fall Y Threshold:** When the `y` distance between the floor and the headset exceeds this distance and `Enable Body Collisions` is true then the rigidbody gravity will be used instead of teleport to drop to nearest floor.
0 commit comments