Stop player from moving in the VR Play Area

Hello All,
I am using SteamVR, and a Vive.
My question is about VR play area movement.
I want to stop the player’s real-life-movement from affecting the player’s in-game-movement. So the player can move around their own room in real life, and character in game will be frozen in place.
I’ve tried attaching a rigid body and freezing all constraints, but no luck.
it looks like the vive is overriding everything when the headset moves.

basically what is happening is the player is in a river, and i want them to have to swim out, but right now the player can just walk out of because i have no way of locking down their play-area-movement.

any help would be greatly appreciated.

It sounds like what you’re trying would be extremely disorienting! But if youre keen to try it you could parent a GameObject to the headset which compensates for the movement of the headset. Lets call this gameobject ‘FreezeHeadset’. It might look like this in the hierarchy

[FreezeHeadset]
|___[Headset]

Then attach a script to the FreezeHeadset with code like this:

class FreezeHeadset extends MonoBehaviour
{
    public GameObject Headset;

    void Enable()
    {
        transform.position = Headset.transform.position;
        Headset.transform.localPosition = Vector3.zero;
    }

    void LateUpdate()
    {
        transform.position -= Headset.transform.localPosition;
    }
}

I think this should do it. Whenever the headset moves the FreezeHeadset gameobject will move an equal amount in an opposite direction. Hope that helps and you may need a spew bag handy

Thanks Adam,
ill give it a try!

I’ll second the opinion that you really shouldn’t do this. Not only is it disorienting, it can also actually be nausea inducing.

void LateUpdate()
{
transform.position = Headset.transform.localPosition *-1;
}

This worked better for me, if someone else has trouble!