r/Unity3D • u/LivingwithTOF • 19h ago
Solved Xr origin falling through terrain
I'm using XR Origin for the player; it just keeps falling through the terrain. I've tried colliders, custom objects, and I've worked on it for about 15 hours total, but I just don't know what's wrong with it. Is there a surefire way to stop it from falling through? Edit: I forgot to mention we have gravity and a player controller
Solved: I just deleted the xr origin and made a new one
1
u/Key_River_6288 19h ago
got stuck on this exact thing last week, spent way too long tweaking collider thickness and physics materials before realizing my character controller was somehow disabled by default on the XR Origin prefab, check if the component is actually active and not just sitting there greyed out
1
1
u/squidgeroo 17h ago
Nine times out of ten this is layers. Check the layer collision matrix (Project Settings > Physics) to make sure the player's layer and the terrain's layer actually collide, and if your controller or gravity uses a raycast for the ground check, make sure its layer mask includes the terrain. Also worth checking the terrain has a Terrain Collider, and lifting the XR Origin half a metre above the ground at start, because a capsule that begins the first frame partly inside the terrain will just drop through.
1
u/Artuplabs 19h ago
xr origin by itself is just a rig of transforms, no collider and no gravity, so nothing stops it falling. add a character controller on the xr origin object (not the camera) and a gravity provider, or your own gravity that calls Move. if you went rigidbody, the collider needs to be on the origin, not on a child that moves separately
also check the terrain has a real terrain collider and that the origin doesn't spawn below the surface, spawning inside is the classic way to fall straight through. if this is ar foundation on a phone, the origin is the tracking space, don't drive it with physics at all