fixed calculation error in automatic model positioning

This commit is contained in:
2018-10-26 17:29:28 +02:00
parent e74dd2861e
commit 5e05b68496
2 changed files with 43 additions and 7 deletions

View File

@@ -96,6 +96,21 @@ GameObject:
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1624064398336504
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 224038629709109506}
m_Layer: 5
m_Name: Icons
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1666907970834032
GameObject:
m_ObjectHideFlags: 1
@@ -602,13 +617,33 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224038629709109506}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 175}
m_SizeDelta: {x: 200, y: 200}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224038629709109506
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1624064398336504}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224034239137159526}
- {fileID: 224603290751646008}
m_Father: {fileID: 224847826353125020}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: 130}
m_SizeDelta: {x: 100, y: 100}
m_AnchoredPosition: {x: 0, y: -106.3}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &224178829673496998
RectTransform:
@@ -621,7 +656,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224847826353125020}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@@ -713,7 +748,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 224847826353125020}
m_Father: {fileID: 224038629709109506}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
@@ -731,8 +766,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 224034239137159526}
- {fileID: 224603290751646008}
- {fileID: 224038629709109506}
- {fileID: 224178829673496998}
m_Father: {fileID: 224214707840811800}
m_RootOrder: 1

View File

@@ -59,7 +59,9 @@ namespace RothenburgAR.UI
var scale = 1f / Mathf.Max(mesh.bounds.size.x, mesh.bounds.size.y, mesh.bounds.size.z);
modelGo.transform.localScale = new Vector3(scale, scale, scale);
modelGo.transform.localPosition = mesh.bounds.center * scale + new Vector3(0, 0, 1.8f);
var pos = -mesh.bounds.center * scale;
pos += new Vector3(0, 0, -modelGo.transform.localPosition.z + 2f);
modelGo.transform.localPosition = pos;
_currentDisplayedModelGo = modelGo;
DetailsModel.CurrentModel = _currentDisplayedModelGo;