So you want to restrict the usual spherical movement that occurs as you move the Vive controller around, to a sort of equatorial, planar movement. I'm going to assume that as in this tutorial, your Vive controllers and head are all part of the same transform hierarchy (what they call
Option A: If you can get the Vive Controller's rotation around the camera (rig). Put sphere into a swivel which is an empty
GameObject, having a transform only. Zero the sphere's local position in the inspector. Make sure swivel's
transform.position tracks that of the head camera. Set sphere's
transform.localPosition=1 to move it slightly forward of the player's head. Set swivel's
.z to the same as the Vive controller's
transform.localEulerAngles, but limit
transform.localEulerAngles.x = 0 on each sphere
Update(). This prevents tilting (up/down) while maintaining heading (north/south/east/west) just like the Vive controller's
transform to which it is attached.
Option B: Possibly Simpler. You want that plane / circle to be around your head, and I think it is never tilted (the validity of this answer relies on this fact). In every sphere
Update(), set sphere's
.z to that of the Vive controller's
transform.position, but set sphere's
transform.localPosition.y equal to desired (head camera)
y, every frame. You can also set the
transform.rotation to the same as the Vive controller, if you need that.
For both options A & B These will superficially work, but you will find that if you look up or down then the sphere will get slightly closer or further away. This is because we are essentially projecting the sphere co-ordinates onto a flat circle. To prevent this i.e. to keep a fixed radius, set sphere's
transform.localPosition.z to the distance you want, which might be the distance between the Vive controller and your camera, which is easy to compute, or you could always set it to, say, 1 unit.
Option C: If the sphere is a child of the Vive controller GameObject. Set Vive controller's
transform.localEulerAngles.x (or maybe
= 0 each frame. Provided your logic runs after the Vive controller's logic, this will do the trick of keeping your object on the circle. Assuming you don't care whether you limit the controller object or the sphere itself, this is the easiest method.
From a mathematical standpoint, we are really just projecting a sphere onto a plane. Between these varied approaches, you should be able to work to a solution. Feel free to ask questions, below.