Advancing on Catalog

This commit is contained in:
Legonzaur 2023-01-17 10:42:17 +01:00
parent 30bb7cc3f2
commit cc4b569ab3
10 changed files with 185 additions and 118 deletions

View File

@ -0,0 +1,83 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: FurnitureSphere
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords:
- _ALPHAPREMULTIPLY_ON
- _SMOOTHNESS_TEXTURE_ALBEDO_CHANNEL_A
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 0.846
- _Glossiness: 0.737
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 1
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 0, g: 0.5, b: 1, a: 0.12941177}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2bdebc2ac16febe4ea3a0afadb5a3805
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -106,7 +106,7 @@ GameObject:
serializedVersion: 6
m_Component:
- component: {fileID: 5690670490328783864}
- component: {fileID: 2962965480065639428}
- component: {fileID: 5727137902744118718}
m_Layer: 0
m_Name: IndoorPlant01
m_TagString: Untagged
@ -121,7 +121,7 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5022219494863929666}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 4.2239313, y: 1.046101, z: -0.024066806}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
@ -130,23 +130,22 @@ Transform:
- {fileID: 1171425573176347497}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!54 &2962965480065639428
Rigidbody:
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!114 &5727137902744118718
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5022219494863929666}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7310167259df75745b825087bf4c8de0, type: 3}
m_Name:
m_EditorClassIdentifier:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
--- !u!1 &8294151951189356629
GameObject:
m_ObjectHideFlags: 0

View File

@ -11,8 +11,8 @@ GameObject:
- component: {fileID: 5869846997090749818}
- component: {fileID: 7411298994668946143}
- component: {fileID: 4701421984937096725}
- component: {fileID: 2966059419517524822}
- component: {fileID: 8484002625320914911}
- component: {fileID: 3699449891368907159}
m_Layer: 0
m_Name: IndoorPlant02
m_TagString: Untagged
@ -27,14 +27,14 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6502689968648656832}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalRotation: {x: -0.7071068, y: 0, z: 0, w: 0.7071068}
m_LocalPosition: {x: 3.9697971, y: 1.0193512, z: -1.9544978}
m_LocalScale: {x: 0.2, y: 0.2, z: 0.2}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!33 &7411298994668946143
MeshFilter:
m_ObjectHideFlags: 0
@ -88,22 +88,6 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!54 &2966059419517524822
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6502689968648656832}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
--- !u!65 &8484002625320914911
BoxCollider:
m_ObjectHideFlags: 0
@ -117,3 +101,18 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1.945082, y: 2.0702388, z: 6.223421}
m_Center: {x: -0.04922211, y: -0.01309447, z: 3.1023586}
--- !u!114 &3699449891368907159
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6502689968648656832}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7310167259df75745b825087bf4c8de0, type: 3}
m_Name:
m_EditorClassIdentifier:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}

View File

@ -259,8 +259,6 @@ GameObject:
m_Component:
- component: {fileID: 2996515769384266075}
- component: {fileID: 2709258200819239477}
- component: {fileID: -1376262336802859445}
- component: {fileID: 6247588457019656027}
- component: {fileID: 6645681851711596344}
m_Layer: 0
m_Name: shelf_empty
@ -305,74 +303,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7310167259df75745b825087bf4c8de0, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &-1376262336802859445
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2512467202128557025}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b93b6a877adcbf94c89a9d6e0c0e844d, type: 3}
m_Name:
m_EditorClassIdentifier:
activateActionSetOnAttach:
actionSetPath:
hideHandOnAttach: 1
hideSkeletonOnAttach: 0
hideControllerOnAttach: 0
handAnimationOnPickup: 0
setRangeOfMotionOnPickup: -1
useHandObjectAttachmentPoint: 1
attachEaseIn: 0
snapAttachEaseInCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
- serializedVersion: 3
time: 1
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0
outWeight: 0
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
snapAttachEaseInTime: 0.15
snapAttachEaseInCompleted: 0
skeletonPoser: {fileID: 0}
handFollowTransform: 1
highlightOnHover: 1
hideHighlight: []
hoverPriority: 0
--- !u!54 &6247588457019656027
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2512467202128557025}
serializedVersion: 2
m_Mass: 30
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 1
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 0
m_CollisionDetection: 0
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
--- !u!65 &6645681851711596344
BoxCollider:
m_ObjectHideFlags: 0

View File

@ -2534,7 +2534,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1251059359212923921, guid: c1bebd6efa306204bb0978afc704a746, type: 3}
propertyPath: m_LocalPosition.y
value: 0.22390294
value: 0.2483
objectReference: {fileID: 0}
- target: {fileID: 1251059359212923921, guid: c1bebd6efa306204bb0978afc704a746, type: 3}
propertyPath: m_LocalPosition.z
@ -3366,6 +3366,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7310167259df75745b825087bf4c8de0, type: 3}
m_Name:
m_EditorClassIdentifier:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
--- !u!1001 &366020801
PrefabInstance:
m_ObjectHideFlags: 0
@ -4076,6 +4079,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1888977164}
m_Modifications:
- target: {fileID: 2048859290140646716, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_RootOrder
value: 0
@ -4128,6 +4135,14 @@ PrefabInstance:
propertyPath: m_Name
value: Simple table
objectReference: {fileID: 0}
- target: {fileID: 4158574887593288270, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6146061087085142095, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7152506842566364840, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_Enabled
value: 0
@ -8262,10 +8277,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 11465950, guid: dc06161b6d97feb419f45f03b62e14b9, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 114000013786455312, guid: dc06161b6d97feb419f45f03b62e14b9, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: dc06161b6d97feb419f45f03b62e14b9, type: 3}
@ -8440,6 +8451,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 808552922}
m_Modifications:
- target: {fileID: 2048859290140646716, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_RootOrder
value: 0
@ -8496,6 +8511,14 @@ PrefabInstance:
propertyPath: m_Name
value: Simple table
objectReference: {fileID: 0}
- target: {fileID: 4158574887593288270, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6146061087085142095, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_StaticEditorFlags
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
--- !u!4 &1317084064 stripped
@ -10558,6 +10581,9 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 7310167259df75745b825087bf4c8de0, type: 3}
m_Name:
m_EditorClassIdentifier:
combinedBounds:
m_Center: {x: 0, y: 0, z: 0}
m_Extent: {x: 0, y: 0, z: 0}
--- !u!4 &1889890278 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5262755222010251265, guid: 481a02167edfebe44883f5868f8a27f9, type: 3}
@ -12337,7 +12363,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 1251059359212923921, guid: c1bebd6efa306204bb0978afc704a746, type: 3}
propertyPath: m_LocalPosition.y
value: 0.22390294
value: 0.2378
objectReference: {fileID: 0}
- target: {fileID: 1251059359212923921, guid: c1bebd6efa306204bb0978afc704a746, type: 3}
propertyPath: m_LocalPosition.z
@ -12873,6 +12899,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1321968106976948543, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 2bdebc2ac16febe4ea3a0afadb5a3805, type: 2}
- target: {fileID: 1527984575184472642, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
propertyPath: m_Name
value: Catalog
@ -12921,6 +12951,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1527984575184472645, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
propertyPath: distance
value: 0.25
objectReference: {fileID: 0}
- target: {fileID: 1770972119431807744, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
propertyPath: m_LocalScale.x
value: 0.04

Binary file not shown.

View File

@ -1,6 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEditor;
using UnityEngine;
using UnityEngine.ProBuilder.Shapes;
using Valve.VR.InteractionSystem;
@ -8,7 +10,6 @@ using Valve.VR.InteractionSystem;
public class Catalog : MonoBehaviour
{
private Player player = null;
private int maxShownObjects = 5;
public int angle = 180;
public float distance = .5f;
public float objectScale = .1f;
@ -16,8 +17,8 @@ public class Catalog : MonoBehaviour
private GameObject spherePrefab;
private Vector3 sphereReturn;
public List<GameObject> Furnitures = new List<GameObject>();
private int maxShownObjects;
// Start is called before the first frame update
void Start()
{
@ -55,8 +56,13 @@ public class Catalog : MonoBehaviour
sphere.SetActive(true);
GameObject furniture = Instantiate(Furnitures[i]);
furniture.transform.localScale*= objectScale;
furniture.transform.parent = sphere.transform;
Furniture objectBounds = furniture.GetComponent<Furniture>();
objectBounds.CalculateBounds();
float rescale = (objectScale / 1.4f) / objectBounds.combinedBounds.size.magnitude;
furniture.transform.localScale *= rescale;
furniture.transform.localPosition = Vector3.down * 0.2f;
}
StartCoroutine(CatalogCoroutine());
}
@ -75,6 +81,7 @@ public class Catalog : MonoBehaviour
private void OnDrawGizmosSelected()
{
maxShownObjects = Furnitures.Count;
float radians = angle * Mathf.Deg2Rad;
float angleIncrement = radians / (maxShownObjects - 1);
for (float i = 0 / 2; i < maxShownObjects; i++)
@ -84,6 +91,7 @@ public class Catalog : MonoBehaviour
}
}
public void OnGrabSphere(GameObject sphere)
{

View File

@ -46,12 +46,15 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
angle: 180
distance: 0.5
distance: 0.25
objectScale: 0.1
Furnitures:
- {fileID: 4774624094512517819, guid: 481a02167edfebe44883f5868f8a27f9, type: 3}
- {fileID: 4158574887593288270, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
- {fileID: 2835658414891243653, guid: ec717aa9a84ac1849bec0aa4f4b89314, type: 3}
- {fileID: 5022219494863929666, guid: 9297f267b46c6fac0abd71ad6e9c91b5, type: 3}
- {fileID: 6502689968648656832, guid: 9cd2b55d7736d196bb33fe0246532f34, type: 3}
- {fileID: 2512467202128557025, guid: fa4ac501e4c6a288483bbfa0e81e97f6, type: 3}
--- !u!1 &6275806258134515848
GameObject:
m_ObjectHideFlags: 0

View File

@ -4,7 +4,7 @@ using UnityEngine;
public class Furniture : MonoBehaviour
{
protected Bounds combinedBounds;
public Bounds combinedBounds;
protected Vector3 centerOffset;
protected void Start()
{
@ -17,7 +17,7 @@ public class Furniture : MonoBehaviour
}
private void CalculateBounds()
public void CalculateBounds()
{
if (GetComponent<Renderer>() != null)
{