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)); } }
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); } }
public Frame3f ToWorldFrame(Frame3f fSceneFrame) { return(SceneFrame.FromFrame(fSceneFrame.Scaled(GetSceneScale()))); }
/// <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)); }