Esempio n. 1
0
        // called on per-frame Update()
        virtual public void PreRender()
        {
            root.Show();

            float useDegrees = (GizmoVisualDegrees > 0) ? GizmoVisualDegrees : SceneGraphConfig.DefaultAxisGizmoVisualDegrees;
            float fWorldSize = VRUtil.GetVRRadiusForVisualAngle(
                root.GetPosition(),
                parentScene.ActiveCamera.GetPosition(),
                useDegrees);
            float fSceneSize = fWorldSize / parentScene.GetSceneScale();
            float fGeomScale = fSceneSize / initialGizmoRadius;

            root.SetLocalScale(new Vector3f(fGeomScale));

            foreach (var widget in Widgets)
            {
                widget.Value.UpdateGizmoWorldSize(fWorldSize);
            }

            if (DynamicVisibilityFiltering && targetWrapper != null)
            {
                Frame3f  frameW  = targetWrapper.GetLocalFrame(CoordSpace.WorldCoords);
                Vector3d camPosW = parentScene.ActiveCamera.GetPosition();
                foreach (var go in enabledWidgetGOs)
                {
                    Standard3DTransformWidget widget = Widgets[go];
                    bool visible = widget.CheckVisibility(ref frameW, ref camPosW);
                    go.SetVisible(visible);
                }
            }
        }
Esempio n. 2
0
 void LateUpdate()
 {
     this.gameObject.transform.position = TrackGO.GetPosition();
     this.gameObject.transform.rotation = TrackGO.GetRotation();
     if (TrackScale)
     {
         this.gameObject.transform.localScale = TrackGO.GetLocalScale();
     }
 }
Esempio n. 3
0
 public override void PreRender()
 {
     if (MaintainConsistentViewSize)
     {
         float fScaling = VRUtil.GetVRRadiusForVisualAngle(
             pivotGO.GetPosition(),
             parentScene.ActiveCamera.GetPosition(),
             SceneGraphConfig.DefaultPivotVisualDegrees);
         fScaling /= parentScene.GetSceneScale();
         pivotGO.SetLocalScale(new Vector3f(fScaling, fScaling, fScaling));
     }
 }
Esempio n. 4
0
        IEnumerator Teleport_Level_Helper(Vector3f vMoveToLocation, Vector3f vNewTargetLocation, Vector3f vPivotAround, float fLevelRotateAngle, float duration)
        {
            yield return(null);

            Sequence mySequence = DOTween.Sequence();

            mySequence.Append(
                ((Material)fadeObject.GetMaterial()).DOFade(1.0f, duration / 3.0f).OnComplete(() => {
                fGameObject sceneGO = UseScene.RootGameObject;

                // set target to new target location explicitly, then reset orbit altitude.
                // now we are level with ground but not at location
                CameraTarget = vPivotAround;
                UseCamera.Manipulator().ResetSceneOrbit(UseScene, false, true, true);

                // add planar rotation if we need it
                if (fLevelRotateAngle != 0)
                {
                    UseCamera.Manipulator().SceneOrbit(UseScene, UseCamera, fLevelRotateAngle, 0.0f);
                }

                // figure out the pan that we would apply to camera, opposite is pan to scene
                Vector3f delta = UseCamera.GetPosition() - vMoveToLocation;
                sceneGO.SetPosition(sceneGO.GetPosition() + delta);
                // also have to shift scene target pos
                CameraTarget = vNewTargetLocation + delta;

                UseCamera.SetTargetVisible(true);
            }));
            mySequence.AppendInterval(duration / 3.0f);
            mySequence.Append(
                ((Material)fadeObject.GetMaterial()).DOFade(0.0f, duration / 3.0f));

            // add a delay before we hide target
            mySequence.AppendInterval(1.0f);
            mySequence.OnComplete(() => {
                UseCamera.SetTargetVisible(false);
            });
        }