AvatarController.SuccessfulCalibration C# (CSharp) Method

SuccessfulCalibration() public method

public SuccessfulCalibration ( uint userId ) : void
userId uint
return void
    public void SuccessfulCalibration(uint userId)
    {
        // reset the models position
        if(offsetNode != null)
        {
            offsetNode.transform.rotation = originalRotation;
        }

        // re-calibrate the position offset
        OffsetCalibrated = false;
    }

Usage Example

Beispiel #1
0
    // loads the avatar object from the input fbx file
    private bool LoadAvatarObject()
    {
        if (loadFilePath == string.Empty)
        {
            return(false);
        }

#if UNITY_EDITOR
        UnityEngine.Object avatarModel = UnityEditor.AssetDatabase.LoadAssetAtPath(loadFilePath, typeof(UnityEngine.Object));
        if (avatarModel == null)
        {
            return(false);
        }

        if (avatarObject != null)
        {
            GameObject.Destroy(avatarObject);
        }

        avatarObject = (GameObject)GameObject.Instantiate(avatarModel);
        if (avatarObject != null)
        {
            avatarObject.transform.position = new Vector3(-1f, 0f, -1f);             // Vector3.zero;
            avatarObject.transform.rotation = Quaternion.identity;

            AvatarController ac = avatarObject.AddComponent <AvatarController>();
            ac.playerIndex = playerIndex;

            ac.mirroredMovement = false;
            ac.verticalMovement = true;

            ac.smoothFactor       = smoothFactor;
            ac.fingerOrientations = fingerOrientations;
            ac.groundedFeet       = groundedFeet;

            ac.Awake();

            KinectManager km = KinectManager.Instance;

            if (km)
            {
                if (km.IsUserDetected())
                {
                    ac.SuccessfulCalibration(km.GetPrimaryUserID());
                }

                km.avatarControllers.Clear();
                km.avatarControllers.Add(ac);
            }
        }

        return(true);
#else
        return(false);
#endif
    }
All Usage Examples Of AvatarController::SuccessfulCalibration