Esempio n. 1
0
    void AdoptPhantomsView()
    {
        var cameraRig    = Camera.main.transform.parent;
        var phantomTrans = phantom.transform;
        var camera       = Camera.main.transform;


        cameraRig.rotation = phantomTrans.rotation * Quaternion.Inverse(camera.localRotation);
        phantom.activated  = false;

        var relativePos = cameraRig.TransformPoint(camera.localPosition) - cameraRig.position;

        var targetPos = phantomTrans.position;

        targetPos.y = 2.25f;
        var rigPos = targetPos + phantomTrans.forward * 0.1f - relativePos;

        cameraRig.position = rigPos;

        tweener.StartFadeOut(0.5f, () => phantom.SetMovable(true));
    }