Exemplo n.º 1
0
 public static Frame3f GetSOLocalFrame(SceneObject so, CoordSpace eSpace)
 {
     if (eSpace == CoordSpace.SceneCoords)
     {
         Frame3f sceneW = UnityUtil.GetGameObjectFrame(so.GetScene().RootGameObject, CoordSpace.WorldCoords);
         Frame3f objW   = UnityUtil.GetGameObjectFrame(so.RootGameObject, CoordSpace.WorldCoords);
         Frame3f result = sceneW.ToFrame(objW);
         // world coords have scene scale applied, we don't want that in scene coords
         if (so.GetScene().GetSceneScale() != 1.0f)
         {
             result = result.Scaled(1.0f / so.GetScene().GetSceneScale());
         }
         return(result);
     }
     else
     {
         return(UnityUtil.GetGameObjectFrame(so.RootGameObject, eSpace));
     }
 }
Exemplo n.º 2
0
 public static void SetSOLocalFrame(SceneObject so, CoordSpace eSpace, Frame3f newFrame)
 {
     if (eSpace == CoordSpace.SceneCoords)
     {
         // scene frames should not be scaled by scene scale, but we want to set as world
         // coords, so we need to apply it now
         if (so.GetScene().GetSceneScale() != 1.0f)
         {
             newFrame = newFrame.Scaled(so.GetScene().GetSceneScale());
         }
         Frame3f sceneW = UnityUtil.GetGameObjectFrame(so.GetScene().RootGameObject, CoordSpace.WorldCoords);
         Frame3f objW   = sceneW.FromFrame(newFrame);
         UnityUtil.SetGameObjectFrame(so.RootGameObject, objW, CoordSpace.WorldCoords);
     }
     else
     {
         UnityUtil.SetGameObjectFrame(so.RootGameObject, newFrame, eSpace);
     }
 }
Exemplo n.º 3
0
 public Frame3f ToWorldFrame(Frame3f fSceneFrame)
 {
     return(SceneFrame.FromFrame(fSceneFrame.Scaled(GetSceneScale())));
 }
Exemplo n.º 4
0
        /// <summary>
        /// Apply the local rotate/translate/scale at transform to frameIn
        /// </summary>
        public static Frame3f ApplyTransform(ITransformed transform, Frame3f frameIn)
        {
            Frame3f result = frameIn.Scaled(transform.GetLocalScale());

            return(transform.GetLocalFrame(CoordSpace.ObjectCoords).FromFrame(result));
        }