Problem with using Character Controller with Vive game

Hello, hopefully someone here has an idea about an issue I’m facing. In my Unity Vive game, I have a free movement locomotion system that uses a Character Controller attached to the CameraRig. The problem is that with room scale, when you walk around, your head (the camera eye) moves, but the CameraRig remains stationary. The result is that the CameraRig is often times not directly below your feet. This is a problem because, for example, if you want to move up a narrow ramp, it’s the Character Controller collider that determines whether your on the ramp or not, and if this isn’t below your feet, then you won’t be able to walk up the ramp correctly. This video demonstrates the issue. You can see the sphere I’ve attached to the CameraRig, and how it determines whether or not I can walk up the terrain. Does anyone have any thoughts? This seems like such a basic thing, but I’m not sure how to work around this.

Hi Spanky,

You can either move the sphere under the camera eye or have the sphere by itself and just place a steamVR tracked object component.

You can see an example of doing something similar around the 3:00 mark of the following video:

Hi, well the sphere in the video is attached to the Vive CameraRig object. In Vive games, if you want to move, you must move this CameraRig. But you can’t force the camera eye to always be above the camera rig (at least I don’t think so) because it’s the camera eye that moves when the user moves around the room-scale environment. Unless you happen to be standing in the center of your play area, it’s always offset by up to a few feet. I don’t think there’s any way to make this work using a Character controller, so I’m trying to code an alternate approach. The user moves by gripping the controller and pointing in the direction they want to travel. When the user grips, I’ll record the current height that the camera is above the terrain. Then as the user moves, I’ll do a raycast down and check if the Y level of the terrain has changes, and then will adjust the CameraRig Y accordingly. I had this partially coded last night, but it wasn’t working right, so today I’ll see if I can fix the issues. I’ll check the video you posted. thanks.

Although it looks like the head sphere is a child of the [CameraRig] it is actually instead at the top of the hierarchy.

All you have to do is attach the Steam VR_Tracked Object to the sphere and set the device index to HMD.

Hello, so I’m a bit confused. In the video I posted, it shows a sphere (with a brick material), and this Sphere is shown in the hierarchy below. So the Sphere in the video is a child of the CameraRig and has a 0f,0f,0f localPosition. Since the CameraRig contains the CharacterController, this functions as the players feet. The video shows how the players eyes which is the Camera (eye), are observing the sphere to the front, and to the left, instead of (like normal feet) directly beneath the players head.
3175163--241984--upload_2017-8-7_10-47-13.png

So when you say “head sphere”, I don’t really know what you are referring to. I’m also not familiar with what SteamVR_TrackedObject does. Can you help clear up my confusion? If what you are suggesting does indeed resolve the issues I’m having, I’d sure love to head about what I need to do! Thanks.

3175163--241984--upload_2017-8-7_10-47-13.png

Ahh . . . I think we were referring to different videos and perhaps I was misunderstanding what you’re wanting.

I typically use VRTK for locomotion beyond the CameraRig perimeter (height adjust teleport or move in place).

I think moving the sphere under the “Camera (head)” would give you the x/z axis tracking you want and then you just have to raycast down to find the height of the terrain.

1 Like