Fixing a Locomotion Bug Using Physics Collision Matrix!
Objective: use physics layers to limit interaction between colliders!
If you have been following along with my VR tutorials than you may have ran into this bug. When a grabbable object colliders with the XR Origin and you go to move, the player will be launched in an unexpected way.
Now, unless you want this type of collision reaction we can easily solve this bug. To begin we need to select our XR Origin. In the top of the inspector select Layer and we need to create a new layer, “XR Origin”
Next, we need to do the same to our basket balls, or what ever grabbable object you are currently using. This needs a new layer, and for the sake of reusability we can name it “Grab Interactives”
Make sure the desired objects are now on their new layers.
From here we can open our project setting and on the left select Physics. If you scroll to the bottom you will find the Physics Matrix! We need to check find where the XR Origin interacts with the Grab Interactives and uncheck it.
Now when we try to recreate the bug there will be no launching of the player.
Don’t be afraid to experiment with the Physics matrix, and I’ll see you in the next tutorial!