Skip to content
Snippets Groups Projects
Commit b71037b0 authored by MaZiFAU's avatar MaZiFAU
Browse files

Refactored FactSpawner

parent a70518a2
No related branches found
No related tags found
No related merge requests found
......@@ -200,7 +200,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3394522495515098197}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalRotation: {x: 0, y: -0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
......@@ -208,7 +208,7 @@ Transform:
- {fileID: 3394522496185282011}
m_Father: {fileID: 5781467132517744785}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: -90, z: 0}
--- !u!33 &3394522495515098201
MeshFilter:
m_ObjectHideFlags: 0
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &1047820262597827614
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 776204628661091474}
- component: {fileID: 1611341617565119760}
- component: {fileID: 3727883962287805668}
- component: {fileID: 8678993674720081185}
m_Layer: 12
m_Name: AngleText_Back
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &776204628661091474
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047820262597827614}
m_LocalRotation: {x: -0.5, y: -0.5, z: -0.5, w: 0.5}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 0.25}
m_Children: []
m_Father: {fileID: 4650993679319476103}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: -90, y: -90, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.7, y: -1.5}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!23 &1611341617565119760
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047820262597827614}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_AdditionalVertexStreams: {fileID: 0}
--- !u!222 &3727883962287805668
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047820262597827614}
m_CullTransparentMesh: 0
--- !u!114 &8678993674720081185
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1047820262597827614}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Test
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4293282880
m_fontColor: {r: 0.25, g: 0.3, b: 0.9, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 2
m_fontSizeBase: 2
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 0
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 1
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_renderer: {fileID: 1611341617565119760}
m_maskType: 0
_SortingLayer: 0
_SortingLayerID: 0
_SortingOrder: 0
--- !u!1 &4650993678488610235
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4650993678488610234}
- component: {fileID: 4650993678488610228}
- component: {fileID: 4650993678488610229}
- component: {fileID: 4650993678488610230}
- component: {fileID: 4650993678488610231}
m_Layer: 12
m_Name: AngleOuter
m_TagString: Selectable
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4650993678488610234
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993678488610235}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 0.02, z: 1}
m_Children:
- {fileID: 4650993679319476103}
m_Father: {fileID: 4650993679089994826}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4650993678488610228
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993678488610235}
m_Mesh: {fileID: 4300000, guid: 4fe93ee2ed2d8c64389611c85232bf23, type: 2}
--- !u!23 &4650993678488610229
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993678488610235}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 8ae9adf4dc782964387385c1e8c0eb72, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &4650993678488610230
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993678488610235}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 626c435b76e0d334f959ede8b54b07ac, type: 3}
m_Name:
m_EditorClassIdentifier:
URI:
--- !u!64 &4650993678488610231
MeshCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993678488610235}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 4
m_Convex: 1
m_CookingOptions: 30
m_Mesh: {fileID: 4300000, guid: 4fe93ee2ed2d8c64389611c85232bf23, type: 2}
--- !u!1 &4650993679089994827
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4650993679089994826}
m_Layer: 12
m_Name: Angle_Old
m_TagString: Selectable
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4650993679089994826
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993679089994827}
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: 4650993678488610234}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &4650993679319476100
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4650993679319476103}
- component: {fileID: 4650993679319476097}
- component: {fileID: 4650993679319476102}
- component: {fileID: 7310199272454353937}
m_Layer: 12
m_Name: AngleInner
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4650993679319476103
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993679319476100}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.95, y: 0.5, z: 0.95}
m_Children:
- {fileID: 6834100498144429849}
- {fileID: 776204628661091474}
m_Father: {fileID: 4650993678488610234}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &4650993679319476097
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993679319476100}
m_Mesh: {fileID: 4300000, guid: 4fe93ee2ed2d8c64389611c85232bf23, type: 2}
--- !u!23 &4650993679319476102
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993679319476100}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 8a28cccde2536794c97ec91954e34e90, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &7310199272454353937
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4650993679319476100}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6b9fc46f5bfe6b4eb4adf01e6b65bac, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &7003220517868882106
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6834100498144429849}
- component: {fileID: 2708246422010202965}
- component: {fileID: 8080899974220995652}
- component: {fileID: 3620593617881097249}
m_Layer: 12
m_Name: AngleText_Front
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6834100498144429849
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7003220517868882106}
m_LocalRotation: {x: 0.5, y: 0.5, z: -0.5, w: 0.5}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 0.25}
m_Children: []
m_Father: {fileID: 4650993679319476103}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 90, y: 90, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0.7, y: 1.5}
m_SizeDelta: {x: 1, y: 1}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!23 &2708246422010202965
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7003220517868882106}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_AdditionalVertexStreams: {fileID: 0}
--- !u!222 &8080899974220995652
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7003220517868882106}
m_CullTransparentMesh: 0
--- !u!114 &3620593617881097249
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7003220517868882106}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Test
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4293282880
m_fontColor: {r: 0.25, g: 0.3, b: 0.9, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 2
m_fontSizeBase: 2
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 0
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 1
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_renderer: {fileID: 2708246422010202965}
m_maskType: 0
_SortingLayer: 0
_SortingLayerID: 0
_SortingOrder: 0
fileFormatVersion: 2
guid: 88cc44a1ed1ae2444b3bd45c300ad7da
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -28,7 +28,7 @@ Transform:
m_GameObject: {fileID: 5866155945383417828}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.96, y: 0.51, z: 0.96}
m_LocalScale: {x: 0.96, y: 1, z: 0.96}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 142224692930156368}
......@@ -110,6 +110,7 @@ GameObject:
- component: {fileID: 142224692930156368}
- component: {fileID: 7167210412035754299}
- component: {fileID: 1078883255209641429}
- component: {fileID: 7621282258514180204}
- component: {fileID: 5602986836502461330}
- component: {fileID: 8419554499757686208}
- component: {fileID: 8526453253978894086}
......@@ -186,6 +187,21 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &7621282258514180204
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6262947649539239553}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 405087c38b8537e43bcc99727c5325ec, type: 3}
m_Name:
m_EditorClassIdentifier:
radius: 1
sideCount: 500
circleMesh: {fileID: 7167210412035754299}
--- !u!114 &5602986836502461330
MonoBehaviour:
m_ObjectHideFlags: 0
......
......@@ -20,6 +20,10 @@ public abstract class AbstractLineFact : FactWrappedCRTP<AbstractLineFact>
[JsonIgnore]
public PointFact Point2 { get => (PointFact)_Facts[Pid2]; }
/// <summary> Distance between <see cref="AbstractLineFact.Pid1"/> and <see cref="AbstractLineFact.Pid2"/></summary>
[JsonIgnore]
public float Distance;
/// <summary>
/// Normalized Direction from <see cref="Pid1"/> to <see cref="Pid2"/>.
/// </summary>
......@@ -79,9 +83,12 @@ private void set_public_members(string pid1, string pid2)
{
this.Pid1 = pid1;
this.Pid2 = pid2;
PointFact pf1 = _Facts[pid1] as PointFact;
PointFact pf2 = _Facts[pid2] as PointFact;
this.Dir = (pf2.Point - pf1.Point).normalized;
this.Dir = (Point1.Point - Point2.Point).normalized;
this.Distance = Dir.magnitude;
Position = Vector3.Lerp(Point1.Point, Point2.Point, 0.5f);
Rotation = Quaternion.LookRotation(Dir, Vector3.up);
LocalScale.Set(Distance, 1, 1);
}
/// \copydoc Fact.hasDependentFacts
......@@ -138,14 +145,8 @@ public class LineFact : AbstractLineFactWrappedCRTP<LineFact>
[JsonProperty]
protected static new string s_type = "LineFact";
/// <summary> Distance between <see cref="AbstractLineFact.Pid1"/> and <see cref="AbstractLineFact.Pid2"/></summary>
public float Distance;
/// <summary> \copydoc Fact.Fact </summary>
public LineFact() : base()
{
Distance = 0;
}
public LineFact() : base() { }
/// <summary> \copydoc AbstractLineFact.AbstractLineFact(AbstractLineFact, Dictionary<string, string>, FactOrganizer) </summary>
public LineFact(LineFact fact, Dictionary<string, string> old_to_new, FactOrganizer organizer) : base(fact, old_to_new, organizer)
......@@ -153,10 +154,7 @@ public LineFact(LineFact fact, Dictionary<string, string> old_to_new, FactOrgani
/// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, string, FactOrganizer) </summary>
public LineFact(string pid1, string pid2, string backendURI, FactOrganizer organizer) : base(pid1, pid2, backendURI, organizer)
{
SetDistance();
_ = this.Label;
}
=> _ = this.Label;
/// <summary> \copydoc AbstractLineFact.AbstractLineFact(string, string, FactOrganizer) </summary>
public LineFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1, pid2, organizer)
......@@ -169,12 +167,6 @@ public LineFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1,
/// <param name="pid2">sets <see cref="AbstractLineFact.Pid2"/></param>
private void init(string pid1, string pid2)
{
SetDistance();
PointFact pf1 = _Facts[pid1] as PointFact;
PointFact pf2 = _Facts[pid2] as PointFact;
float v = (pf1.Point - pf2.Point).magnitude;
SOMDoc lhs =
new OMA(
new OMS(MMT_OMS_URI.Metric),
......@@ -185,7 +177,7 @@ private void init(string pid1, string pid2)
);
SOMDoc valueTp = new OMS(MMT_OMS_URI.RealLit);
SOMDoc value = new OMF(v);
SOMDoc value = new OMF(Distance);
MMTValueDeclaration mmtDecl = new(this.Label, lhs, valueTp, value);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
......@@ -235,10 +227,6 @@ protected override bool EquivalentWrapped(LineFact f1, LineFact f2)
return (p1f1.Equivalent(p1f2) && p2f1.Equivalent(p2f2))
;//|| (p1f1.Equivalent(p2f2) && p2f1.Equivalent(p1f2));
}
/// <summary> Calculates and sets <see cref="Distance"/>; <remarks> <see cref="AbstractLineFact.Pid1"/> and <see cref="AbstractLineFact.Pid2"/> needs to be set first.</remarks></summary>
private void SetDistance()
=> this.Distance = Vector3.Distance(((PointFact)_Facts[Pid1]).Point, ((PointFact)_Facts[Pid2]).Point);
}
/// <summary>
......@@ -272,6 +260,8 @@ public RayFact(string pid1, string pid2, FactOrganizer organizer) : base(pid1, p
/// <param name="pid2">sets <see cref="AbstractLineFact.Pid2"/></param>
private void init(string pid1, string pid2)
{
LocalScale = new Vector3(float.PositiveInfinity, 1, 1);
SOMDoc tp = new OMS(MMT_OMS_URI.LineType);
SOMDoc df = new OMA(
new OMS(MMT_OMS_URI.LineOf),
......
......@@ -7,10 +7,7 @@
using static SOMDocManager;
using static CommunicationEvents;
using JsonSubTypes;
using System.Linq.Expressions;
using UnityEngine.ProBuilder;
using System.Reflection;
using System.Linq;
public class ParsingDictionary
{
......@@ -208,6 +205,14 @@ public string Label
[JsonIgnore]
protected FactOrganizer _Facts;
[JsonIgnore]
public Vector3 Position { get; protected set; } = Vector3.zero;
[JsonIgnore]
public Quaternion Rotation { get; protected set; } = Quaternion.identity;
[JsonIgnore]
public Vector3 LocalScale { get; protected set; } = Vector3.one;
/// <summary>
/// Only being used by [JsonReader](https://www.newtonsoft.com/json/help/html/T_Newtonsoft_Json_JsonReader.htm) to initiate empty \ref Fact "Facts".
/// <seealso cref="SOMDocManager"/>
......@@ -254,7 +259,7 @@ protected Fact(Fact fact, FactOrganizer organizer)
public bool rename(string newLabel)
// returns true if succeded
{
if (string.IsNullOrEmpty(newLabel))
if (string.IsNullOrEmpty(newLabel) && _Facts.GetNumberOfFacts() != 0)
// switch back to autogenerated
{
generateLabel();
......@@ -453,6 +458,9 @@ private void init(Vector3 P, Vector3 N)
this.Point = P;
this.Normal = N;
Position = P;
Rotation = Quaternion.LookRotation(N);
SOMDoc tp = new OMS(MMT_OMS_URI.Point);
SOMDoc df = new OMA(
new OMS(MMT_OMS_URI.Tuple),
......@@ -584,6 +592,23 @@ private void init(string pid, string rid)
this.Pid = pid;
this.Rid = rid;
Position = Point.Position;
{ //Rotation
Vector3 up = Point.Normal;
Vector3 forward = Ray.Dir;
if(Math3d.IsApproximatelyEqual(up, forward))
{
Vector3 arbitary = Math3d.IsApproximatelyEqual(forward, Vector3.forward)
? Vector3.right
: Vector3.forward;
up = Vector3.Cross(arbitary, forward);
}
Rotation = Quaternion.LookRotation(forward, up);
}
SOMDoc tp = new OMA(
new OMS(MMT_OMS_URI.Ded),
new List<SOMDoc> {
......@@ -700,7 +725,8 @@ public class AngleFact : FactWrappedCRTP<AngleFact>
/// <summary> <see langword="true"/>, if AngleFact is approximately 90° or 270°</summary>
public bool is_right_angle;
[JsonIgnore]
public float angle;
/// <summary> \copydoc Fact.Fact </summary>
public AngleFact() : base()
......@@ -742,9 +768,27 @@ private void init(string pid1, string pid2, string pid3)
this.Pid2 = pid2;
this.Pid3 = pid3;
float v = GetAngle(); // sets is_right_angle
ComputeAngle(); // sets is_right_angle, angle
Position = Point2.Position;
{ //Rotation
Vector3 from = (Point1.Position - Position).normalized;
Vector3 to = (Point3.Position - Position).normalized;
Vector3 up = Vector3.Cross(to, from);
Vector3 forwoard = (from + to).normalized;
if (up.sqrMagnitude < Math3d.vectorPrecission)
{ //Angle is 180° (or 0°)
Vector3 arbitary = up.normalized == Vector3.forward ? Vector3.right : Vector3.forward;
up = Vector3.Cross(arbitary, to);
forwoard = Vector3.Cross(up, to);
}
Rotation = Quaternion.LookRotation(forwoard, up);
}
MMTDeclaration mmtDecl = generateNot90DegreeAngleDeclaration(v, pid1, pid2, pid3);
MMTDeclaration mmtDecl = generateNot90DegreeAngleDeclaration(angle, pid1, pid2, pid3);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -762,7 +806,7 @@ public AngleFact(string Pid1, string Pid2, string Pid3, string backendURI, FactO
this.Pid2 = Pid2;
this.Pid3 = Pid3;
_ = GetAngle();
_ = ComputeAngle();
this._URI = backendURI;
_ = this.Label;
}
......@@ -777,7 +821,6 @@ public AngleFact(string Pid1, string Pid2, string Pid3, float angle, string back
_ = this.Label;
}
/// \copydoc Fact.parseFact(Scroll.ScrollFact)
public new static AngleFact parseFact(Scroll.ScrollFact fact)
{
......@@ -829,16 +872,16 @@ protected override string generateLabel()
/// Computes smallest angle and sets <see cref="is_right_angle"/>
/// </summary>
/// <returns>Smallets angle between [<see cref="Pid1"/>, <see cref="Pid2"/>] and [<see cref="Pid2"/>, <see cref="Pid3"/>]</returns>
private float GetAngle()
private float ComputeAngle()
{
PointFact pf1 = _Facts[Pid1] as PointFact;
PointFact pf2 = _Facts[Pid2] as PointFact;
PointFact pf3 = _Facts[Pid3] as PointFact;
float v = Vector3.Angle((pf1.Point - pf2.Point), (pf3.Point - pf2.Point));
this.is_right_angle = Mathf.Abs(v - 90.0f) < 0.01;
angle = Vector3.Angle((pf1.Point - pf2.Point), (pf3.Point - pf2.Point));
this.is_right_angle = Mathf.Abs(angle - 90.0f) < 0.01;
return is_right_angle ? 90f : v;
return is_right_angle ? 90f : angle;
}
/// <summary>
......@@ -999,6 +1042,24 @@ private void init(string pid1, string pid2, string pid3)
this.Pid2 = pid2;
this.Pid3 = pid3;
Position = Point2.Position;
{ //Rotation
Vector3 from = (Point1.Position - Position).normalized;
Vector3 to = (Point3.Position - Position).normalized;
Vector3 up = Vector3.Cross(to, from);
Vector3 forwoard = (from + to).normalized;
if (up.sqrMagnitude < Math3d.vectorPrecission)
{ //Angle is 180° (or 0°)
Vector3 arbitary = up.normalized == Vector3.forward ? Vector3.right : Vector3.forward;
up = Vector3.Cross(arbitary, to);
forwoard = Vector3.Cross(up, to);
}
Rotation = Quaternion.LookRotation(forwoard, up);
}
AddFactResponse.sendAdd(generateMMTDeclaration(pid1, pid2, pid3), out this._URI);
}
......@@ -1391,6 +1452,10 @@ private void init(string pid1, string pid2, float radius, Vector3 normal)
this.radius = radius;
this.normal = normal;
Position = Point1.Position;
Rotation = Quaternion.LookRotation(normal);
LocalScale = new Vector3(radius, 1, radius);
MMTDeclaration mmtDecl = generateCircleFactDeclaration(pid1, pid2, radius, normal);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -1621,6 +1686,9 @@ private void init(string pid, string cid)
this.Pid = pid;
this.Cid = cid;;
Position = Point.Position;
Rotation = Circle.Rotation;
SOMDoc tp =
new OMA(
new OMS(MMT_OMS_URI.Ded),
......@@ -1735,8 +1803,13 @@ public class AngleCircleLineFact : FactWrappedCRTP<AngleCircleLineFact>
[JsonIgnore]
public CircleFact Circle { get => (CircleFact)_Facts[Cid1]; }
//TODO? deg or rad?
[JsonIgnore]
public float angle;
[JsonIgnore]
public Vector3 intersection;
/// <summary> \copydoc Fact.Fact </summary>
public AngleCircleLineFact() : base()
{
......@@ -1752,7 +1825,7 @@ public AngleCircleLineFact() : base()
/// <param name="old_to_new"><c>Dictionary</c> mapping <paramref name="fact"/>.<see cref="getDependentFactIds"/> in <paramref name="fact"/>.<see cref="Fact._Facts"/> to corresponding <see cref="Fact.Id"/> in <paramref name="organizer"/> </param>
/// <param name="organizer">sets <see cref="_Facts"/></param>
public AngleCircleLineFact(AngleCircleLineFact fact, Dictionary<string, string> old_to_new, FactOrganizer organizer) : base(fact, organizer)
=> init(old_to_new[fact.Cid1], old_to_new[fact.Rid2], fact.angle);
=> init(old_to_new[fact.Cid1], old_to_new[fact.Rid2]);
/// <summary>
/// Standard Constructor
......@@ -1761,8 +1834,8 @@ public AngleCircleLineFact(AngleCircleLineFact fact, Dictionary<string, string>
/// <param name="rid2">sets <see cref="Rid2"/></param>
/// <param name="angle"> sets the angle </param>
/// <param name="organizer">sets <see cref="Fact._Facts"/></param>
public AngleCircleLineFact(string cid1, string rid2, float angle, FactOrganizer organizer) : base(organizer)
=> init(cid1, rid2, angle);
public AngleCircleLineFact(string cid1, string rid2, FactOrganizer organizer) : base(organizer)
=> init(cid1, rid2);
/// <summary>
/// Initiates <see cref="Cid1"/>, <see cref="Rid2"/>, <see cref="angle"/> <see cref="Fact._URI"/> and creates MMT %Fact Server-Side
......@@ -1770,11 +1843,34 @@ public AngleCircleLineFact(string cid1, string rid2, float angle, FactOrganizer
/// <param name="cid1">sets <see cref="Cid1"/></param>
/// <param name="rid2">sets <see cref="Rid2"/></param>
/// <param name="angle"> sets the angle </param>
private void init(string cid1, string rid2, float angle)
private void init(string cid1, string rid2)
{
this.Cid1 = cid1;
this.Rid2 = rid2;
this.angle = angle;
this.angle = Math3d.AngleVectorPlane(Ray.Dir, Circle.normal).ToDegrees();
Math3d.LinePlaneIntersection(out intersection, Ray.Point1.Position, Ray.Dir, Circle.normal, Circle.Position);
Position = intersection;
{ //Rotation
Vector3 from = (Circle.Position - Position).normalized;
Vector3 angle_to = Math3d.IsApproximatelyEqual(intersection, Ray.Point1.Position)
? Ray.Point2.Position
: Ray.Point1.Position;
Vector3 to = (angle_to - Position).normalized;
Vector3 up = Vector3.Cross(to, from);
Vector3 forwoard = (from + to).normalized;
if (up.sqrMagnitude < Math3d.vectorPrecission)
{ //Angle is 180° (or 0°)
Vector3 arbitary = up.normalized == Vector3.forward ? Vector3.right : Vector3.forward;
up = Vector3.Cross(arbitary, to);
forwoard = Vector3.Cross(up, to);
}
Rotation = Quaternion.LookRotation(forwoard, up);
}
MMTDeclaration mmtDecl = generateMMTDeclaration(angle, cid1, rid2);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
......@@ -1948,6 +2044,9 @@ private void init(string cid1)
CircleFact cf1 = _Facts[cid1] as CircleFact;
this.rad = cf1.radius;
Position = Circle.Position;
Rotation = Circle.Rotation;
MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, this.rad);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -2095,6 +2194,9 @@ private void init(string cid1)
CircleFact cf1 = _Facts[cid1] as CircleFact;
this.A = cf1.radius * cf1.radius * ((float)System.Math.PI);
Position = Circle.Position;
Rotation = Circle.Rotation;
MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, this.A);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -2246,6 +2348,9 @@ private void init(string cid1, string pid1, float vol)
this.Pid1 = pid1;
this.vol = vol;
Position = Point.Position;
Rotation = Circle.Rotation;
MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, pid1, vol);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -2381,6 +2486,14 @@ public class OrthogonalCircleLineFact : FactWrappedCRTP<OrthogonalCircleLineFact
[JsonIgnore]
public AbstractLineFact Ray { get => (AbstractLineFact)_Facts[Lid1]; }
//TODO? deg or rad?
[JsonIgnore]
public float angle = 90f;
[JsonIgnore]
public Vector3 intersection;
/// <summary> \copydoc Fact.Fact </summary>
public OrthogonalCircleLineFact() : base()
{
......@@ -2415,6 +2528,21 @@ private void init(string cid1, string lid1)
{
this.Cid1 = cid1;
this.Lid1 = lid1;
Math3d.LinePlaneIntersection(out intersection, Ray.Point1.Position, Ray.Dir, Circle.normal, Circle.Position);
Position = intersection;
{ //Rotation
Vector3 from = (Circle.Position - Position).normalized;
Vector3 angle_to = Math3d.IsApproximatelyEqual(intersection, Ray.Point1.Position)
? Ray.Point2.Position
: Ray.Point1.Position;
Vector3 to = (angle_to - Position).normalized;
Vector3 up = Vector3.Cross(to, from);
Vector3 forward = (from + to).normalized;
Rotation = Quaternion.LookRotation(forward, up);
}
MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, lid1);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
......@@ -2599,6 +2727,9 @@ private void init(string cid1, string cid2, float vol, string unequalproof, OMA
this.unequalCirclesProof = unequalproof;
this.vol = vol;
Position = Circle2.Position;
Rotation = Circle2.Rotation;
MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, cid2, vol, unequalproof, proof);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -2786,6 +2917,9 @@ private void init(string cid1, string cid2, float vol, string eqProof, OMA proof
this.equalCirclesProof = eqProof;
this.vol = vol;
Position = Circle2.Position;
Rotation = Circle2.Rotation;
MMTDeclaration mmtDecl = generateMMTDeclaration(cid1, cid2, vol, eqProof, proof);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -2956,6 +3090,9 @@ private void init(string cid1, string cid2)
this.Cid1 = cid1;
this.Cid2 = cid2;
Position = Circle1.Position;
Rotation = Circle1.Rotation;
MMTDeclaration mmtDecl = generateEqualCirclesFactDeclaration(cid1, cid2);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......@@ -3132,6 +3269,9 @@ private void init(string cid1, string cid2)
this.Cid1 = cid1;
this.Cid2 = cid2;
Position = Circle2.Position;
Rotation = Circle2.Rotation;
MMTDeclaration mmtDecl = generateUnEqualCirclesFactDeclaration(cid1, cid2);
AddFactResponse.sendAdd(mmtDecl, out this._URI);
}
......
......@@ -157,7 +157,7 @@ public static AngleCircleLineFact AddAngleCircleLineFact(string cid, string lid,
{
AngleCircleLineFact angle = (AngleCircleLineFact)AddFactIfNotFound(
new AngleCircleLineFact(cid, lid, angleValue, StageStatic.stage.factState)
new AngleCircleLineFact(cid, lid, StageStatic.stage.factState)
, out _, samestep, gadget, scroll_label);
if (Mathf.Approximately(Mathf.Abs(angleValue), 90.0f))
......
......@@ -58,30 +58,26 @@ public Fact SpawnPoint(Fact pointFact)
public Fact SpawnLine(Fact fact)
{
LineFact lineFact = ((LineFact)fact);
Vector3 point1 = lineFact.Point1.Point;
Vector3 point2 = lineFact.Point2.Point;
//Change FactRepresentation to Line
GameObject line = GameObject.Instantiate(Line);
//Place the Line in the centre of the two points
line.transform.position = Vector3.Lerp(point1, point2, 0.5f);
line.transform.position = lineFact.Position;
//Change scale and rotation, so that the two points are connected by the line
//Get the Line-GameObject as the first Child of the Line-Prefab -> That's the Collider
var v3T = line.transform.GetChild(0).localScale;
//For every Coordinate x,y,z we have to devide it by the LocalScale of the Child,
//because actually the Child should be of this length and not the parent, which is only the Collider
v3T.x = (point2 - point1).magnitude / line.transform.GetChild(0).GetChild(0).localScale.x;
v3T.x = lineFact.LocalScale.x / line.transform.GetChild(0).GetChild(0).localScale.x;
//Change Scale/Rotation of the Line-GameObject without affecting Scale of the Text
line.transform.GetChild(0).localScale = v3T;
line.transform.GetChild(0).rotation = Quaternion.FromToRotation(Vector3.right, lineFact.Dir);
line.transform.GetChild(0).rotation = lineFact.Rotation;
//string letter = ((Char)(64 + lineFact.Id + 1)).ToString();
//line.GetComponentInChildren<TextMeshPro>().text = letter;
line.GetComponentInChildren<TextMeshPro>().text =
lineFact.Label + " = " + Math.Round((point1-point2).magnitude, 2) + " m";
lineFact.Label + " = " + Math.Round(lineFact.Distance, 2) + " m";
line.GetComponentInChildren<FactObject>().URI = lineFact.Id;
lineFact.Representation = line;
return lineFact;
......@@ -90,25 +86,21 @@ public Fact SpawnLine(Fact fact)
public Fact SpawnRay(Fact fact)
{
RayFact rayFact = ((RayFact)fact);
Vector3 point1 = rayFact.Point1.Point;
Vector3 point2 = rayFact.Point2.Point;
//Change FactRepresentation to Line
GameObject line = GameObject.Instantiate(Ray);
//Place the Line in the centre of the two points
line.transform.position = Vector3.Lerp(point1, point2, 0.5f);
line.transform.position = rayFact.Position;
//Change scale and rotation, so that the two points are connected by the line
//Get the Line-GameObject as the first Child of the Line-Prefab -> That's the Collider
var v3T = line.transform.GetChild(0).localScale;
//For every Coordinate x,y,z we have to devide it by the LocalScale of the Child,
//because actually the Child should be of this length and not the parent, which is only the Collider
v3T.x = (point2 - point1).magnitude * 100 / line.transform.GetChild(0).GetChild(0).localScale.x;
v3T.x = rayFact.LocalScale.x / line.transform.GetChild(0).GetChild(0).localScale.x;
//Change Scale/Rotation of the Line-GameObject without affecting Scale of the Text
line.transform.GetChild(0).localScale = v3T;
line.transform.GetChild(0).rotation = Quaternion.FromToRotation(Vector3.right, rayFact.Dir);
line.transform.GetChild(0).rotation = rayFact.Rotation;
line.GetComponentInChildren<TextMeshPro>().text = rayFact.Label;
line.GetComponentInChildren<FactObject>().URI = rayFact.Id;
......@@ -120,20 +112,22 @@ public Fact SpawnRay(Fact fact)
//Spawn an angle: point with id = angleFact.Pid2 is the point where the angle gets applied
public Fact SpawnAngle(Fact fact)
{
Vector3 point1, point2, point3;
Vector3 Psotion;
Quaternion Rotation;
float angleValue;
// TODO: just use simple inheritence or similar!!
if (fact is RightAngleFact rightangleFact)
{
point1 = rightangleFact.Point1.Point;
point2 = rightangleFact.Point2.Point;
point3 = rightangleFact.Point3.Point;
Psotion = rightangleFact.Position;
Rotation = rightangleFact.Rotation;
angleValue = 90f;
}
else if (fact is AngleFact angleFact)
{
point1 = angleFact.Point1.Point;
point2 = angleFact.Point2.Point;
point3 = angleFact.Point3.Point;
Psotion = angleFact.Position;
Rotation = angleFact.Rotation;
angleValue = angleFact.angle;
}
else
throw new Exception("Invalid Type:" + fact.GetType().ToString());
......@@ -141,33 +135,15 @@ public Fact SpawnAngle(Fact fact)
//Change FactRepresentation to Angle
GameObject angle = GameObject.Instantiate(Angle);
//Calculate Angle:
Vector3 from = (point3 - point2).normalized;
Vector3 to = (point1 - point2).normalized;
float angleValue = Vector3.Angle(from, to); //We always get an angle between 0 and 180° here
//Change scale and rotation, so that the angle is in between the two lines
Vector3 forwoard = (from + to).normalized;
Vector3 up = Vector3.Cross(to, from);
if (up.sqrMagnitude < Math3d.vectorPrecission) { //Angle is 180° (or 0°)
Vector3 arbitary = up.normalized == Vector3.forward ? Vector3.right : Vector3.forward;
up = Vector3.Cross(arbitary, to);
forwoard = to;
} else
forwoard = Vector3.Cross(forwoard, up);
//Place the Angle at position of point2
angle.transform.SetPositionAndRotation(point2, Quaternion.LookRotation(forwoard, up));
angle.transform.SetPositionAndRotation(Psotion, Rotation);
//Set text of angle
TextMeshPro[] texts = angle.GetComponentsInChildren<TextMeshPro>();
foreach (TextMeshPro t in texts) {
//Change Text not to the id, but to the angle-value (from both sides) AND change font-size relative to length of the angle (from both sides)
t.text = Math.Round((double) angleValue, 2) + "°";
t.fontSize = angle.GetComponentInChildren<TextMeshPro>().fontSize * angle.transform.GetChild(0).transform.GetChild(0).localScale.x;
foreach (TextMeshPro t in texts)
{
//Change Text not to the id, but to the angle-value (from both sides)
t.text = Math.Round(angleValue, 2) + "°";
}
//Generate angle mesh
......@@ -182,107 +158,52 @@ public Fact SpawnAngle(Fact fact)
public Fact SpawnRingAndCircle(Fact fact)
{
CircleFact circleFact = fact as CircleFact;
var ringAndCircleGO = new GameObject("RingAndCircle");
_ = SpawnRing(fact, ringAndCircleGO.transform);
var circleFact = SpawnCircle(fact, ringAndCircleGO.transform);
SpawnRing(circleFact, ringAndCircleGO.transform);
SpawnCircle(circleFact, ringAndCircleGO.transform);
//TODO check whether this is necessary?
// this.FactRepresentation = ringAndCircleGO;
circleFact.Representation = ringAndCircleGO;
//Move Ring to middlePoint
ringAndCircleGO.transform.position = circleFact.Position;
return circleFact;
fact.Representation = ringAndCircleGO;
return fact;
}
public Fact SpawnRing(Fact fact, Transform parent = null)
public void SpawnRing(CircleFact circleFact, Transform parent = null)
{
CircleFact circleFact = (CircleFact)fact;
PointFact middlePointFact = circleFact.Point1;
PointFact basePointFact = circleFact.Point2;
Vector3 middlePoint = middlePointFact.Point;
Vector3 normal = circleFact.normal;
float radius = circleFact.radius;
//Change FactRepresentation to Ring
//TODO check whether this is necessary?
//this.FactRepresentation = Ring;
//GameObject ring = Instantiate(FactRepresentation, parent);
GameObject ring = GameObject.Instantiate(Ring, parent);
var tori = ring.GetComponentsInChildren<TorusGenerator>();
var tmpText = ring.GetComponentInChildren<TextMeshPro>();
var FactObj = ring.GetComponentInChildren<FactObject>();
//Move Ring to middlePoint
ring.transform.position = middlePoint;
//Rotate Ring according to normal
if (normal.y < 0) // if normal faces downwards use inverted normal instead
ring.transform.up = -normal;
else
ring.transform.up = normal;
//Set radii
foreach (var torus in tori)
torus.torusRadius = radius;
torus.torusRadius = circleFact.radius;
string text = $"○{middlePointFact.Label}";
tmpText.text = text;
////move TMP Text so it is on the edge of the circle
//tmpText.rectTransform.position = tmpText.rectTransform.position - new Vector3(0, 0, -radius);
tmpText.text = $"○{circleFact.Point1.Label}";
FactObj.URI = circleFact.Id;
circleFact.Representation = ring;
return circleFact;
}
public Fact SpawnCircle(Fact fact, Transform parent = null)
public void SpawnCircle(CircleFact circleFact, Transform parent = null)
{
CircleFact circleFact = (CircleFact)fact;
PointFact middlePointFact = circleFact.Point1;
PointFact basePointFact = circleFact.Point2;
Vector3 middlePoint = middlePointFact.Point;
Vector3 normal = circleFact.normal;
float radius = circleFact.radius;
//TODO check whether this is necessary
//Change FactRepresentation to Ring
// this.FactRepresentation = Circle;
GameObject circle = Instantiate(Circle, parent);
var FactObj = circle.GetComponentInChildren<FactObject>();
//Move Circle to middlePoint
circle.transform.position = middlePoint;
//Rotate Circle according to normal
if (normal.y < 0) // if normal faces downwards use inverted normal instead
circle.transform.up = -normal;
else
circle.transform.up = normal;
//Set radius
circle.transform.localScale = new Vector3(radius, circle.transform.localScale.y, radius);
circle.transform.localScale = Vector3.Scale(circle.transform.localScale, circleFact.LocalScale);
FactObj.URI = circleFact.Id;
circleFact.Representation = circle;
return circleFact;
}
public void DeleteObject(Fact fact)
{
//print("Deleting: " + fact.Representation?.name);
GameObject.Destroy(fact.Representation);
}
=> GameObject.Destroy(fact.Representation);
public void animateNonExistingFactTrigger(Fact fact) {
public void animateNonExistingFactTrigger(Fact fact)
{
StartCoroutine(animateNonExistingFact(fact));
IEnumerator animateNonExistingFact(Fact fact)
......
......@@ -26,7 +26,9 @@ protected static Mesh CreateMesh((Vector3[] vertices, int[] triangles) meshValue
return mesh;
}
protected static Vector3[] GetCirclePoints(float circleRadius, int pointCount) => GetCirclePoints(circleRadius, pointCount, Vector3.zero);
protected static Vector3[] GetCirclePoints(float circleRadius, int pointCount)
=> GetCirclePoints(circleRadius, pointCount, Vector3.zero);
protected static Vector3[] GetCirclePoints(float circleRadius, int pointCount, Vector3 offset)
{
Vector3[] circle = new Vector3[pointCount];
......
......@@ -24,6 +24,7 @@ protected override void GenerateShape()
{
if (torusMesh.sharedMesh != null)
torusMesh.sharedMesh.Clear();
torusMesh.mesh = CreateMesh(CreateTorus(torusRadius, ringRadius, ringSegmentCount, segmentSideCount));
if (torusMesh.transform.TryGetComponent(out MeshCollider meshCol))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment