Walk.Update C# (CSharp) Method

Update() public method

public Update ( ) : void
return void
    void Update()
    {
        //turn the movement on or off with a trigger/rap
        if (Cardboard.SDK.Triggered)
            isMoving = !isMoving;

        if (isMoving) {
            Vector3 direction = new Vector3 (head.transform.forward.x, 0, head.transform.forward.z).normalized * speed * Time.deltaTime;
            Quaternion rotation = Quaternion.Euler (new Vector3 (0, -transform.rotation.eulerAngles.y, 0));
            transform.Translate (rotation * direction);
        }
        if(fixedHeight)
        {
            transform.position = new Vector3(transform.position.x, yOffset, transform.position.z);
        }
    }