generated from VR-Sexe/Unity3DTemplate
Catalog grab
This commit is contained in:
parent
96f3ff8a08
commit
63b569e7c9
@ -1,5 +1,7 @@
|
||||
using System.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEngine;
|
||||
using UnityEngine.ProBuilder.Shapes;
|
||||
using Valve.VR.InteractionSystem;
|
||||
|
||||
public class Catalog : MonoBehaviour
|
||||
@ -9,9 +11,14 @@ public class Catalog : MonoBehaviour
|
||||
public int angle = 180;
|
||||
public float distance = .5f;
|
||||
public float objectScale = .1f;
|
||||
|
||||
private GameObject spherePrefab;
|
||||
|
||||
private Vector3 sphereReturn;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
spherePrefab = transform.Find("Sphere").gameObject;
|
||||
player = Player.instance;
|
||||
if (player == null)
|
||||
{
|
||||
@ -37,10 +44,11 @@ public class Catalog : MonoBehaviour
|
||||
for (float i = 0 / 2; i < maxShownObjects; i++)
|
||||
{
|
||||
var j = i * angleIncrement - radians / 2;
|
||||
var sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
|
||||
var sphere = Instantiate(spherePrefab);
|
||||
sphere.transform.parent = transform;
|
||||
sphere.transform.localScale = Vector3.one * objectScale;
|
||||
sphere.transform.localPosition = new Vector3(Mathf.Sin(j), 0, Mathf.Cos(j)) * distance;
|
||||
sphere.SetActive(true);
|
||||
}
|
||||
|
||||
StartCoroutine(CatalogCoroutine());
|
||||
@ -68,4 +76,16 @@ public class Catalog : MonoBehaviour
|
||||
Gizmos.DrawWireSphere(transform.position + new Vector3(Mathf.Sin(j), 0, Mathf.Cos(j)) * distance, objectScale / 2);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnGrabSphere(GameObject sphere)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnReleaseSphere(GameObject sphere)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
44
Assets/CatalogElement.cs
Normal file
44
Assets/CatalogElement.cs
Normal file
@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using Valve.VR.InteractionSystem;
|
||||
|
||||
public class CatalogElement : MonoBehaviour
|
||||
{
|
||||
public Vector3 returnPosition;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
returnPosition = transform.localPosition;
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnGrabSphere()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void OnReleaseSphere()
|
||||
{
|
||||
StartCoroutine(ReturnSphere());
|
||||
}
|
||||
|
||||
private IEnumerator ReturnSphere()
|
||||
{
|
||||
float time = 0;
|
||||
Vector3 startPosition = transform.localPosition;
|
||||
while (time <= 1)
|
||||
{
|
||||
transform.localPosition = Vector3.Lerp(startPosition, returnPosition, time);
|
||||
time += Time.deltaTime*4;
|
||||
yield return null;
|
||||
}
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
11
Assets/CatalogElement.cs.meta
Normal file
11
Assets/CatalogElement.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6be44b6db6259b44aa167854e71e96f9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -97,7 +97,7 @@ LightmapSettings:
|
||||
m_ExportTrainingData: 0
|
||||
m_TrainingDataDestination: TrainingData
|
||||
m_LightProbeSampleCountMultiplier: 4
|
||||
m_LightingDataAsset: {fileID: 112000000, guid: 513619d267b6f204fb3ddc20611ca1ff, type: 2}
|
||||
m_LightingDataAsset: {fileID: 112000000, guid: d7e6e31c30cd8e7458997e0ee8f825c9, type: 2}
|
||||
m_LightingSettings: {fileID: 4890085278179872738, guid: e0d1b39396743fc4da42f1d1948a6570, type: 2}
|
||||
--- !u!196 &4
|
||||
NavMeshSettings:
|
||||
@ -2744,7 +2744,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5554971243091150254, guid: 124ae331af1b2e845b7de5a2ccb168d4, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.22556937
|
||||
value: 0.444
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5554971243091150254, guid: 124ae331af1b2e845b7de5a2ccb168d4, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
@ -4021,6 +4021,118 @@ Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 3674349604157782260, guid: b4f1c52a4d9acc94da08e9006d9fd5e0, type: 3}
|
||||
m_PrefabInstance: {fileID: 472164267}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &517030984 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 6275806258134515848, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
|
||||
m_PrefabInstance: {fileID: 1527984575637916537}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &517030986
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 517030984}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: ffefbea063cab884ca33e5a449e5c22c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
attachmentFlags: 44
|
||||
attachmentOffset: {fileID: 0}
|
||||
catchingSpeedThreshold: -1
|
||||
releaseVelocityStyle: 1
|
||||
releaseVelocityTimeOffset: -0.011
|
||||
scaleReleaseVelocity: 1.1
|
||||
scaleReleaseVelocityThreshold: -1
|
||||
scaleReleaseVelocityCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0.1
|
||||
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
|
||||
restoreOriginalParent: 1
|
||||
onPickUp:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 517030994}
|
||||
m_TargetAssemblyTypeName: CatalogElement, Assembly-CSharp
|
||||
m_MethodName: OnGrabSphere
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onDetachFromHand:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 517030994}
|
||||
m_TargetAssemblyTypeName: CatalogElement, Assembly-CSharp
|
||||
m_MethodName: OnReleaseSphere
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
onHeldUpdate:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
interactable: {fileID: 0}
|
||||
--- !u!54 &517030987
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 517030984}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 126
|
||||
m_CollisionDetection: 0
|
||||
--- !u!114 &517030994
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 517030984}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 6be44b6db6259b44aa167854e71e96f9, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
returnPosition: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &527112787
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -8282,7 +8394,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5554971243091150254, guid: 124ae331af1b2e845b7de5a2ccb168d4, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.22556937
|
||||
value: 0.486
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5554971243091150254, guid: 124ae331af1b2e845b7de5a2ccb168d4, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
@ -11489,7 +11601,7 @@ Mesh:
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: pb_Mesh37430
|
||||
m_Name: pb_Mesh30778
|
||||
serializedVersion: 10
|
||||
m_SubMeshes:
|
||||
- serializedVersion: 2
|
||||
@ -12057,7 +12169,7 @@ PrefabInstance:
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5554971243091150254, guid: 124ae331af1b2e845b7de5a2ccb168d4, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.22556937
|
||||
value: 0.445
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5554971243091150254, guid: 124ae331af1b2e845b7de5a2ccb168d4, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
@ -12398,6 +12510,14 @@ PrefabInstance:
|
||||
propertyPath: m_ConstrainProportionsScale
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3102087200456469538, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
|
||||
propertyPath: hideHandOnAttach
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6275806258134515848, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 1805c511e7b7f0e49afb0651e27725b4, type: 3}
|
||||
--- !u!1001 &7278954555104977257
|
||||
|
||||
BIN
Assets/Scenes/FabLab/FabLab/ReflectionProbe-0.png
(Stored with Git LFS)
BIN
Assets/Scenes/FabLab/FabLab/ReflectionProbe-0.png
(Stored with Git LFS)
Binary file not shown.
@ -101,30 +101,6 @@ TextureImporter:
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Android
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: iPhone
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: WebGL
|
||||
maxTextureSize: 2048
|
||||
@ -137,18 +113,6 @@ TextureImporter:
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
- serializedVersion: 3
|
||||
buildTarget: Windows Store Apps
|
||||
maxTextureSize: 2048
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 1
|
||||
compressionQuality: 50
|
||||
crunchedCompression: 0
|
||||
allowsAlphaSplitting: 0
|
||||
overridden: 0
|
||||
androidETC2FallbackOverride: 0
|
||||
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||
spriteSheet:
|
||||
serializedVersion: 2
|
||||
sprites: []
|
||||
|
||||
@ -60,7 +60,7 @@ MonoBehaviour:
|
||||
m_Name: Standalone Settings
|
||||
m_EditorClassIdentifier:
|
||||
m_LoaderManagerInstance: {fileID: -7336662873422740244}
|
||||
m_InitManagerOnStart: 0
|
||||
m_InitManagerOnStart: 1
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user