Пример #1
0
    // Use this for initialization
    void Start()
    {
        modelAnimator = GetComponent <ModelAnimator>();

        //Load starting positions
        startingPositions = modelAnimator.readAnimationsFromFile(Application.dataPath + "/Resources/NAOStartingPositions.txt");
        //Set returnToStartingPosition to false for each one
        foreach (ModelAnimation anim in startingPositions)
        {
            anim.returnToStartingPosition = false;
        }

        //Load locally created moves
        modelAnimator.animations = modelAnimator.readAnimationsFromFile();

        //Move to fighting stance
        StartCoroutine(modelAnimator.animateModel(startingPositions[1], val => isMoving = val));
    }
    //

    // Use this for initialization
    void Start()
    {
        modelAnimator = GetComponent <ModelAnimator>();

        //Load starting positions
        //startingPositions = modelAnimator.readAnimationsFromFile("Assets/Resources/NAOStartingPositions.txt");
        startingPositions = modelAnimator.readAnimationsFromFile(Application.dataPath + "/Resources/NAOStartingPositions.txt");
        //Set returnToStartingPosition to false for each one
        foreach (ModelAnimation anim in startingPositions)
        {
            anim.returnToStartingPosition = false;
        }

        //Load locally created moves
        modelAnimator.animations = modelAnimator.readAnimationsFromFile();

        //Set up mouse orbit stuff
        Vector3 angles = transform.eulerAngles;

        x = angles.y;
        y = angles.x;

        transform.rotation = Quaternion.Euler(y, x, 0);
        //transform.position = transform.rotation * new Vector3(0.0f, 1.0f, -cameraOrbitDistance) + target.position;
        transform.position = target.transform.position - new Vector3(0.0f, -1.0f, -cameraOrbitDistance);

        // Make the rigid body not change rotation
        if (rigidbody)
        {
            rigidbody.freezeRotation = true;
        }

        //Set up dragging stuff
        //mainCamera = Camera.mainCamera;

        maxElbowDistanceFromShoulder = leftShoulder.lossyScale.x * .8F;
        maxHandDistanceFromShoulder  = (leftShoulder.lossyScale.x * .8F) + (leftHand.lossyScale.x * .8F);
        maxKneeDistanceFromHip       = leftThigh.lossyScale.x * 1.15F;   //* .8F;
        //maxFootDistanceFromHip = (leftThigh.lossyScale.x * .8F) + (leftCalf.lossyScale.x * .8F);
        maxFootDistanceFromHip = (leftThigh.lossyScale.x * 1.15F) + (leftCalf.lossyScale.x * 1.15F);
    }