diff --git a/Assets/Resources/Prefabs/Facts/Cuboid.prefab b/Assets/Resources/Prefabs/Facts/Cuboid.prefab index b19caa772d6a630ad357a2088d57ddda45b04be7..e494aa34c027ab6db97c5ea7b31a13c28c135509 100644 --- a/Assets/Resources/Prefabs/Facts/Cuboid.prefab +++ b/Assets/Resources/Prefabs/Facts/Cuboid.prefab @@ -1,103 +1,5 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: ---- !u!1 &1505725766792024532 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 5832209075015652957} - - component: {fileID: 7172006547624197216} - - component: {fileID: 1446189528306001303} - - component: {fileID: 1951502042095310522} - m_Layer: 0 - m_Name: Cylinder - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!4 &5832209075015652957 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1505725766792024532} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: -0.036, y: 0.139, z: 0.894} - m_LocalScale: {x: 0.120354, y: 0.07818309, z: 0.74706006} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 3390467403729316765} - m_RootOrder: 2 - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!33 &7172006547624197216 -MeshFilter: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1505725766792024532} - m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0} ---- !u!23 &1446189528306001303 -MeshRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1505725766792024532} - m_Enabled: 1 - m_CastShadows: 1 - m_ReceiveShadows: 1 - m_DynamicOccludee: 1 - m_StaticShadowCaster: 0 - m_MotionVectors: 1 - m_LightProbeUsage: 1 - m_ReflectionProbeUsage: 1 - m_RayTracingMode: 2 - m_RayTraceProcedural: 0 - m_RenderingLayerMask: 1 - m_RendererPriority: 0 - m_Materials: - - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0} - 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: 1 - 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!136 &1951502042095310522 -CapsuleCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1505725766792024532} - m_Material: {fileID: 0} - m_IsTrigger: 0 - m_Enabled: 1 - m_Radius: 0.5000001 - m_Height: 2 - m_Direction: 1 - m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697} --- !u!1 &6839596689016440457 GameObject: m_ObjectHideFlags: 0 @@ -129,7 +31,6 @@ Transform: m_Children: - {fileID: 6662482376097614856} - {fileID: 5831357366368800904} - - {fileID: 5832209075015652957} m_Father: {fileID: 0} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} diff --git a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CuboidFact.cs b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CuboidFact.cs index 2d739311ad10ad78218c41a2c1865a41fb6510ee..916a249860e98e1741a3277447afc3c411b9ffd5 100644 --- a/Assets/Scripts/InteractionEngine/FactHandling/Facts/CuboidFact.cs +++ b/Assets/Scripts/InteractionEngine/FactHandling/Facts/CuboidFact.cs @@ -52,16 +52,21 @@ protected void calculate_vectors(){ float sidelengthTB = Vector3.Distance(T, B); float sidelengthBC = Vector3.Distance(B, C); - LocalScale = new Vector3(sidelengthBA+0.1F, sidelengthTB+0.1F, sidelengthBC+0.1F); + LocalScale = new Vector3(sidelengthBC + 0.1F, sidelengthBA + 0.1F, sidelengthTB + 0.1F); Volume = sidelengthBA * sidelengthBC * sidelengthTB; Position = B + 0.5F * ((A - B) + (T - B) + (C - B)); - Vector3 cross = Vector3.Cross((T - B), (A - B)); - Rotation = Quaternion.LookRotation(cross.normalized, (T - B).normalized); + Vector3 cross = Vector3.Cross((A - B), (C - B)); + Vector3 cross2 = Vector3.Cross((T - B), (C - B)); - Rotation = Quaternion.identity; + Vector3 right = Vector3.Cross(cross, cross2).normalized; + + Vector3 up = Vector3.Cross(right, cross).normalized; + + Rotation = Quaternion.LookRotation(cross, up); + } public CuboidFact() : base(){