Starting prototyping catalog

This commit is contained in:
Legonzaur 2023-01-13 17:01:02 +01:00
parent 1d936f4868
commit ec64073c87
17 changed files with 186 additions and 156 deletions

71
Assets/Catalog.cs Normal file
View File

@ -0,0 +1,71 @@
using System.Collections;
using UnityEngine;
using Valve.VR.InteractionSystem;
public class Catalog : MonoBehaviour
{
private Player player = null;
public int maxShownObjects = 5;
public int angle = 180;
public float distance = .5f;
public float objectScale = .1f;
// Start is called before the first frame update
void Start()
{
player = Player.instance;
if (player == null)
{
Debug.LogError("<b>[SteamVR Interaction]</b> Teleport: No Player instance found in map.", this);
Destroy(this.gameObject);
return;
}
ShowCatalog();
}
// Update is called once per frame
void Update()
{
}
private void ShowCatalog()
{
gameObject.transform.SetParent(player.hands[0].transform);
gameObject.transform.localPosition = Vector3.zero;
float radians = angle * Mathf.Deg2Rad;
float angleIncrement = radians / (maxShownObjects - 1);
for (float i = 0 / 2; i < maxShownObjects; i++)
{
var j = i * angleIncrement - radians / 2;
var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
sphere.transform.parent = transform;
sphere.transform.localScale = Vector3.one * objectScale;
sphere.transform.localPosition = new Vector3(Mathf.Sin(j), 0, Mathf.Cos(j)) * distance;
}
StartCoroutine(CatalogCoroutine());
}
private IEnumerator CatalogCoroutine()
{
var hand = player.hands;
while (true)
{
transform.rotation = Quaternion.RotateTowards(transform.rotation, player.hmdTransform.rotation, 380);
transform.eulerAngles = new Vector3(transform.eulerAngles.x, 0, transform.eulerAngles.z);
yield return null;
}
}
private void OnDrawGizmosSelected()
{
float radians = angle * Mathf.Deg2Rad;
float angleIncrement = radians / (maxShownObjects - 1);
for (float i = 0 / 2; i < maxShownObjects; i++)
{
var j = i * angleIncrement - radians / 2;
Gizmos.DrawWireSphere(transform.position + new Vector3(Mathf.Sin(j), 0, Mathf.Cos(j)) * distance, objectScale / 2);
}
}
}

11
Assets/Catalog.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6e448cbb02ada1545b6c4c79341232fc
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -47,7 +47,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -107,7 +107,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -32,7 +32,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -47,7 +47,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -42,7 +42,7 @@ ModelImporter:
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
isReadable: 1
meshes:
lODScreenPercentages: []
globalScale: 1

View File

@ -293,7 +293,22 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls: []
interactable: {fileID: 0}
--- !u!114 &5066673686994042309
--- !u!114 &9084598848516749552
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2096603271310898739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 783750eec4c41da428b7651515146d14, type: 3}
m_Name:
m_EditorClassIdentifier:
velocityAverageFrames: 5
angularVelocityAverageFrames: 11
estimateOnAwake: 0
--- !u!114 &3960184586102675806
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@ -320,21 +335,6 @@ MonoBehaviour:
previewPoseSelection: 0
blendingBehaviours: []
scale: 1
--- !u!114 &9084598848516749552
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2096603271310898739}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 783750eec4c41da428b7651515146d14, type: 3}
m_Name:
m_EditorClassIdentifier:
velocityAverageFrames: 5
angularVelocityAverageFrames: 11
estimateOnAwake: 0
--- !u!1 &7570475958632844146 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: -516098083770646512, guid: d8f1959686ece1243846f554fdcd7273, type: 3}

View File

@ -21,8 +21,8 @@ MonoBehaviour:
pinkyFingerMovementType: 0
ignoreRootPoseData: 1
ignoreWristPoseData: 1
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 0}
position: {x: 0.000000059604645, y: 0, z: 0}
rotation: {x: 0, y: -0, z: -0, w: -1}
bonePositions: []
boneRotations: []
rightHand:
@ -35,7 +35,7 @@ MonoBehaviour:
ignoreRootPoseData: 1
ignoreWristPoseData: 1
position: {x: 0, y: 0, z: 0}
rotation: {x: 0, y: 0, z: 0, w: 0}
rotation: {x: -0, y: -0, z: -0, w: 1}
bonePositions: []
boneRotations: []
applyToSkeletonRoot: 1

View File

@ -2854,7 +2854,7 @@ Transform:
- {fileID: 1378541949}
- {fileID: 363747407}
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &165972124
GameObject:
@ -4748,7 +4748,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 8531222383232042004, guid: 0615df42b5cd5f1429cafa57731d1869, type: 3}
propertyPath: m_RootOrder
value: 3
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8531222383232042004, guid: 0615df42b5cd5f1429cafa57731d1869, type: 3}
propertyPath: m_LocalPosition.x
@ -5862,7 +5862,7 @@ Transform:
- {fileID: 260965695}
- {fileID: 1288997560}
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &466555361
GameObject:
@ -6099,7 +6099,7 @@ PrefabInstance:
m_Modifications:
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_RootOrder
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_LocalScale.z
@ -6149,7 +6149,12 @@ PrefabInstance:
propertyPath: m_Name
value: Simple table
objectReference: {fileID: 0}
m_RemovedComponents: []
- target: {fileID: 7152506842566364840, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents:
- {fileID: 7152506842566364840, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
--- !u!4 &472164268 stripped
Transform:
@ -6193,6 +6198,54 @@ Transform:
- {fileID: 223162560}
- {fileID: 1031756479}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &520683835
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 520683837}
- component: {fileID: 520683836}
m_Layer: 0
m_Name: Catalog
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &520683836
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 520683835}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6e448cbb02ada1545b6c4c79341232fc, type: 3}
m_Name:
m_EditorClassIdentifier:
maxShownObjects: 6
angle: 130
distance: 0.41
objectScale: 0.16
--- !u!4 &520683837
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 520683835}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 2.0397532, y: 1.6641229, z: -1.5216272}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &527112787
@ -9250,7 +9303,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_RootOrder
value: 2
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalPosition.x
@ -9690,7 +9743,7 @@ Transform:
- {fileID: 2128333932}
- {fileID: 197140882}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &817029044 stripped
Transform:
@ -10441,7 +10494,7 @@ Transform:
- {fileID: 360260910}
- {fileID: 671061970}
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &933062237
PrefabInstance:
@ -10538,7 +10591,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 2996515769384266075, guid: fa4ac501e4c6a288483bbfa0e81e97f6, type: 3}
propertyPath: m_RootOrder
value: 11
value: 12
objectReference: {fileID: 0}
- target: {fileID: 2996515769384266075, guid: fa4ac501e4c6a288483bbfa0e81e97f6, type: 3}
propertyPath: m_LocalPosition.x
@ -11613,7 +11666,7 @@ Transform:
- {fileID: 1557224834}
- {fileID: 133861093}
m_Father: {fileID: 0}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1180503447
PrefabInstance:
@ -12773,7 +12826,7 @@ Transform:
- {fileID: 1620530528}
- {fileID: 788326936}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1557224832
GameObject:
@ -12845,30 +12898,6 @@ GameObject:
m_CorrespondingSourceObject: {fileID: 160596, guid: dc06161b6d97feb419f45f03b62e14b9, type: 3}
m_PrefabInstance: {fileID: 1290121935}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1558616914
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1558616909}
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: b2f511c1adaa1e94ebe7ca97bbcabd17, type: 3}
m_Name:
m_EditorClassIdentifier:
pose: {fileID: 0}
interactWithUI:
actionPath: /actions/default/in/InteractUI
needsReinit: 0
active: 1
color: {r: 0, g: 0, b: 0, a: 0}
thickness: 0.002
clickColor: {r: 0, g: 1, b: 0, a: 1}
holder: {fileID: 0}
pointer: {fileID: 0}
addRigidBody: 0
reference: {fileID: 0}
--- !u!114 &1558616915
MonoBehaviour:
m_ObjectHideFlags: 0
@ -12981,80 +13010,6 @@ Transform:
m_CorrespondingSourceObject: {fileID: 5262755222010251265, guid: 481a02167edfebe44883f5868f8a27f9, type: 3}
m_PrefabInstance: {fileID: 1234385523}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1670087242
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1888977164}
m_Modifications:
- target: {fileID: 4699182198977620406, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_Name
value: computer
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalScale.x
value: 1.3359
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalScale.y
value: 1.3359
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalScale.z
value: 1.3359
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalPosition.x
value: -0.39174962
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalPosition.y
value: -2.1072216
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalPosition.z
value: 1.8198769
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalRotation.w
value: 0.70710784
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalRotation.y
value: 0.70710576
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 90
objectReference: {fileID: 0}
- target: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: ab468a82ad445da4e9a084297505261f, type: 3}
--- !u!4 &1670087243 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 5367457311287030540, guid: ab468a82ad445da4e9a084297505261f, type: 3}
m_PrefabInstance: {fileID: 1670087242}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1672585691
GameObject:
m_ObjectHideFlags: 0
@ -13095,7 +13050,7 @@ Transform:
- {fileID: 1403294835}
- {fileID: 527112788}
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1695254330
PrefabInstance:
@ -13202,7 +13157,7 @@ Transform:
- {fileID: 1695254331}
- {fileID: 1180503448}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &1727196003
PrefabInstance:
@ -14492,7 +14447,6 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1670087243}
- {fileID: 472164268}
- {fileID: 802860442}
- {fileID: 242326303}

View File

@ -1,10 +1,5 @@
using Oculus.Interaction.PoseDetection;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
public class MovableFurniture : MonoBehaviour
{
@ -37,7 +32,7 @@ public class MovableFurniture : MonoBehaviour
// Update is called once per frame
void Update()
{
}
public void OnPointerClickUp()
@ -50,9 +45,9 @@ public class MovableFurniture : MonoBehaviour
}
public void OnPointerClickDown()
{
if(_rigidbody!= null)
if (_rigidbody != null)
{
_rigidbody.useGravity= false;
_rigidbody.useGravity = false;
}
}
@ -79,11 +74,11 @@ public class MovableFurniture : MonoBehaviour
public void SnapTo(Vector3 position, LayerMask layerMask)
{
Vector3 displacement = Vector3.zero;
this.transform.position = position+centerOffset;
this.transform.position = position + centerOffset;
Vector3[] directions = { Vector3.right, Vector3.left, Vector3.up, Vector3.down, Vector3.forward, Vector3.back };
int[] extents = { 0,0,1,1,2,2 };
for (int i = 0; i<6; i++ )
int[] extents = { 0, 0, 1, 1, 2, 2 };
for (int i = 0; i < 6; i++)
{
Ray raycast = new Ray(transform.position - centerOffset - (directions[i] * combinedBounds.extents[extents[i]]), (directions[i] * combinedBounds.size[extents[i]]));
RaycastHit hit;
@ -113,7 +108,7 @@ public class MovableFurniture : MonoBehaviour
// Draw a yellow sphere at the transform's position
Gizmos.color = Color.red;
Gizmos.DrawWireCube(transform.position - centerOffset, combinedBounds.size);
Gizmos.DrawRay((transform.position - centerOffset) - (new Vector3(0,0,combinedBounds.extents.z)), (new Vector3(0, 0, combinedBounds.size.z)));
Gizmos.DrawRay((transform.position - centerOffset) - (new Vector3(0, 0, combinedBounds.extents.z)), (new Vector3(0, 0, combinedBounds.size.z)));
}
private void CalculateBounds()
@ -142,7 +137,6 @@ public class MovableFurniture : MonoBehaviour
}
}
//combinedBounds = renderers[0].bounds;
Debug.Log(combinedBounds.center);
centerOffset = transform.position - combinedBounds.center;
}
}