void CalibrateFloor() { if (BodySourceManager == null) { return; } _BodyManager = BodySourceManager.GetComponent <BodySourceManager>(); if (_BodyManager == null) { return; } Kinect.Vector4 FloorData = _BodyManager.GetFloorData(); if (FloorData == null) { return; } float floorHeight = GetFloorHeight(FloorData); if (floorHeight != 0f) { Debug.Log("Calibrating floor height and tilt."); Ground.transform.position = new Vector3(Ground.transform.position.x, GetFloorHeight(FloorData) * _FloorHeightMultiplier, Ground.transform.position.z); Ground.transform.eulerAngles = new Vector3((float)GetTilt(FloorData), Ground.transform.eulerAngles.y, Ground.transform.eulerAngles.z); Physics.gravity = new Vector3(0, (float)Math.Cos(GetTilt(FloorData) * Math.PI / 180f) * -9.81f, (float)Math.Sin(GetTilt(FloorData) * Math.PI / 180f) * -9.81f); } else { Debug.Log("The Kinect's field of view is limited. Not calibrating floor height and tilt."); } }