protected virtual void SetLocalTransform(Vector3 newPosition, Quaternion newRotation)
        {
            // Only apply values if they are valid for this config:
            if (trackingType == TrackingType.Rotation || trackingType == TrackingType.RotationAndPosition)
            {
                newTransformValue.rotation = newRotation;
            }

            if (trackingType == TrackingType.Position || trackingType == TrackingType.RotationAndPosition)
            {
                newTransformValue.position = newPosition;
            }

            if (transformManipulator != null)
            {
                // Use the transform manipulator:
                transformManipulator.Input(newTransformValue);
            }
            else
            {
                if (updateType == UpdateType.Rigidbody)
                {
                    // TODO: these are in local space. fix!
                    ourRigidbody.MovePosition(newTransformValue.position);
                    ourRigidbody.MoveRotation(newTransformValue.rotation);
                    ourRigidbody.velocity        = GetVelocity();
                    ourRigidbody.angularVelocity = GetAngularVelocity();
                }
                else
                {
                    // Direct set:
                    newTransformValue.ApplyTo(transform, true);
                }
            }
        }
Пример #2
0
        protected virtual void Output(TransformValues newState)
        {
            if (target == null)
            {
                return;
            }

            newState.ApplyTo(target, useLocalSpace);
        }