Example #1
0
        // configure gizmo - constructs necessary ITransformWrapper to provide
        // desired gizmo behavior. You can modify behavior in subclasses by
        // overriding InitializeTransformWrapper (but you must
        void SetActiveFrame(FrameType eFrame)
        {
            // disconect existing wrapper
            if (targetWrapper != null)
            {
                targetWrapper.Target.OnTransformModified -= onTransformModified;
            }

            // if we have multiple targets, we construct a transient SO to
            // act as a parent (stored as internalGroupSO)
            if (targets.Count > 1 && internalGroupSO == null)
            {
                internalGroupSO = new TransientGroupSO();
                internalGroupSO.Create();
                parentScene.AddSceneObject(internalGroupSO);
                internalGroupSO.AddChildren(targets);
            }
            SceneObject useSO = (targets.Count == 1) ? targets[0] : internalGroupSO;

            // construct the wrapper
            targetWrapper = InitializeTransformWrapper(useSO, eFrame);

            //connect up to it
            targetWrapper.Target.OnTransformModified += onTransformModified;
            onTransformModified(null);

            // configure gizmo
            update_active();
        }
Example #2
0
        void SetActiveFrame(FrameType eFrame)
        {
            if (eFrame == FrameType.LocalFrame)
            {
                targetWrapper = new PassThroughWrapper(target);
            }
            else
            {
                targetWrapper = new SceneFrameWrapper(parentScene, target);
            }

            // update gizmo transform to match target frame
            Frame3 widgetFrame = targetWrapper.GetLocalFrame(CoordSpace.ObjectCoords);

            gizmo.transform.localPosition = widgetFrame.Origin;
            gizmo.transform.localRotation = widgetFrame.Rotation;
        }
 // you can override this with your own targetWrapper setup code
 virtual protected void InitializeTargetWrapper()
 {
     Debug.Assert(this.targets.Count == 1);
     targetWrapper = new PassThroughWrapper(this.targets[0]);
 }