Esempio n. 1
0
        public void EmissionConeDrawingFinished()
        {
            RenderedConeMeshFilter.sharedMesh = null;
            if (leftPos.Count > 1)
            {
                TimeManager.StackEmissionCone(Tuple.Create(
                                                  emissionCurve.ControlPoints.ToList(),
                                                  emissionCurve.GetFlattenedCache(BezierFit.ParameterType.Time).ToList(),
                                                  emissionDataKeys),
                                              animScript
                                              );

                NewEmissionCone(leftPos, rightPos, times);
            }
            EmissionConeDrawingInProgress = false;
            animScript.Deselected();
        }
Esempio n. 2
0
        public static void StopTransforming(GestureRecognizerState state)
        {
            var opTpl = undoStack.Pop();

            undoStack.Push(Tuple.Create(opTpl.Item1, opTpl.Item2, NumFrame - NumFrameBeforeGesture));

            switch (state)
            {
            case GestureRecognizerState.Translating:
                var curHandPosition = poseManager.GetHandTransform(OvrAvatar.HandType.Right, PoseManager.HandJoint.IndexTip).position;
                var addVector       = (controlledObject.transform.parent == null) ?
                                      (curHandPosition - initialHandPosition) :
                                      controlledObject.transform.parent.InverseTransformVector(curHandPosition - initialHandPosition);
                controlledObject.AddTranslationKey(initialObjectPose.transform.localPosition + addVector, CurFrame);
                break;

            case GestureRecognizerState.Scaling:
                var curInterHandDistance = (
                    poseManager.GetHandTransform(OvrAvatar.HandType.Right, PoseManager.HandJoint.IndexTip).position -
                    poseManager.GetHandTransform(OvrAvatar.HandType.Left, PoseManager.HandJoint.IndexTip).position
                    ).magnitude;
                controlledObject.AddScaleKey(initialObjectPose.transform.localScale * (curInterHandDistance / (initialInterHandDistance + float.Epsilon)), CurFrame);
                break;

            case GestureRecognizerState.Rotating:
                var rotation = ComputeCurrentRotation();
                rotation = ((initialObjectPose.transform.parent == null) ?
                            Quaternion.identity :
                            Quaternion.Inverse(initialObjectPose.transform.parent.rotation)) * rotation;
                controlledObject.AddRotationKey(rotation, CurFrame);
                break;
            }
            controlledObject.EvaluateTransform(CurFrame);

            controlledObject.Deselected();
            controlledObject = null;
            if (IsRecording)
            {
                PauseAnimationInScript();
            }
        }