VstyleR, rackamackafån
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Regular → Executable
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,6 +2,7 @@
|
||||
using System.Collections;
|
||||
|
||||
public class FurnitureMiniature : MonoBehaviour {
|
||||
|
||||
public void Grab() {
|
||||
transform.parent = null;
|
||||
foreach (var collider in GetComponentsInChildren<Collider>()) {
|
||||
|
||||
+12
-15
@@ -3,16 +3,13 @@ using System.Collections;
|
||||
|
||||
public class LeftController : MonoBehaviour {
|
||||
|
||||
public bool AlwaysCenter = false;
|
||||
public GameObject MainCamera;
|
||||
public GameObject WarehouseCamera;
|
||||
|
||||
Transform controllerRig;
|
||||
SteamVR_ControllerEvents controllerEvents;
|
||||
|
||||
GameObject mainCamera;
|
||||
GameObject warehouseCamera;
|
||||
|
||||
CameraFade cameraFade;
|
||||
SteamVR_Camera mainSteamVRCamera;
|
||||
|
||||
bool inWarehouse = false;
|
||||
|
||||
@@ -21,14 +18,11 @@ public class LeftController : MonoBehaviour {
|
||||
|
||||
controllerEvents = GetComponent<SteamVR_ControllerEvents>();
|
||||
controllerEvents.TriggerAxisChanged += triggerAxisChanged;
|
||||
|
||||
cameraFade = MainCamera.GetComponentInChildren<CameraFade>();
|
||||
}
|
||||
|
||||
void Start () {
|
||||
mainCamera = GameObject.Find("Main Camera (origin)");
|
||||
warehouseCamera = GameObject.Find("Warehouse Camera (origin)");
|
||||
|
||||
cameraFade = mainCamera.GetComponentInChildren<CameraFade>();
|
||||
mainSteamVRCamera = mainCamera.GetComponentInChildren<SteamVR_Camera>();
|
||||
}
|
||||
|
||||
void triggerAxisChanged(object sender, ControllerClickedEventArgs e) {
|
||||
@@ -36,18 +30,21 @@ public class LeftController : MonoBehaviour {
|
||||
if (alpha > 0.05) {
|
||||
cameraFade.SetFade(alpha);
|
||||
if (!inWarehouse) {
|
||||
controllerRig.SetParent(warehouseCamera.transform, false);
|
||||
if (AlwaysCenter) {
|
||||
warehouseCamera.transform.localPosition = new Vector3(-mainSteamVRCamera.head.localPosition.x, warehouseCamera.transform.localPosition.y, -mainSteamVRCamera.head.localPosition.z);
|
||||
}
|
||||
WarehouseCamera.SetActive(true);
|
||||
controllerRig.SetParent(WarehouseCamera.transform, false);
|
||||
inWarehouse = true;
|
||||
}
|
||||
} else {
|
||||
cameraFade.SetFade(0.0f);
|
||||
if (inWarehouse) {
|
||||
controllerRig.SetParent(mainCamera.transform, false);
|
||||
controllerRig.SetParent(MainCamera.transform, false);
|
||||
WarehouseCamera.SetActive(false);
|
||||
inWarehouse = false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var measurement in GameObject.FindObjectsOfType<Measurement>()) {
|
||||
measurement.InWarehouse = inWarehouse;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
+16
-5
@@ -15,6 +15,8 @@ public class Measurement : MonoBehaviour {
|
||||
|
||||
private float LineWidth;
|
||||
|
||||
public bool InWarehouse = false;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
@@ -35,6 +37,10 @@ public class Measurement : MonoBehaviour {
|
||||
Vector3 middlePosition = (LocalStartPosition + (LocalEndPosition - LocalStartPosition) / 2.0f);
|
||||
|
||||
float smallestScale = Mathf.Min(transform.lossyScale.x, Mathf.Min(transform.lossyScale.y, transform.lossyScale.z));
|
||||
|
||||
if(InWarehouse) {
|
||||
smallestScale = smallestScale / 10.0f;
|
||||
}
|
||||
|
||||
if (smallestScale < 0.4f)
|
||||
{
|
||||
@@ -74,7 +80,7 @@ public class Measurement : MonoBehaviour {
|
||||
textMesh.text = textMagnitude.ToString("0.00") + "m";
|
||||
|
||||
|
||||
textMesh.characterSize = Mathf.Max(0.001f * Math.Min(1.0f , textMagnitude), 0.002f);
|
||||
textMesh.characterSize = Mathf.Max(0.0005f * Math.Min(1.0f , textMagnitude), 0.0005f);
|
||||
|
||||
HoleSize = Mathf.Max(0.1f * Math.Min(1.0f, magnitude), 0.05f);
|
||||
|
||||
@@ -90,8 +96,13 @@ public class Measurement : MonoBehaviour {
|
||||
line2BaseRenderer.SetPosition(0, LocalEndPosition + lineUp * 0.01f);
|
||||
line2BaseRenderer.SetPosition(1, LocalEndPosition - lineUp * 0.01f);
|
||||
|
||||
|
||||
LineWidth = Mathf.Min(DefaultLineWith*smallestScale, 0.003f);
|
||||
if(InWarehouse) {
|
||||
LineWidth = 0.007f;
|
||||
}
|
||||
else {
|
||||
LineWidth = Mathf.Min(DefaultLineWith * smallestScale, 0.003f);
|
||||
}
|
||||
|
||||
|
||||
line1Renderer.SetWidth(LineWidth, LineWidth);
|
||||
line2Renderer.SetWidth(LineWidth, LineWidth);
|
||||
@@ -105,7 +116,7 @@ public class Measurement : MonoBehaviour {
|
||||
LineRenderer lineMiddleRenderer = line1BaseTransform.GetComponent<LineRenderer>();
|
||||
lineMiddleRenderer.SetWidth(LineWidth, LineWidth);
|
||||
|
||||
Vector3 upDistance = new Vector3(0, 2.0f, 0);
|
||||
Vector3 upDistance = new Vector3(0, 20.0f, 0);
|
||||
upDistance = upDistance*smallestScale;
|
||||
|
||||
textTransform.position = middlePosition + upDistance*1.1f;
|
||||
@@ -115,7 +126,7 @@ public class Measurement : MonoBehaviour {
|
||||
lineMiddleRenderer.SetPosition(1, middlePosition + upDistance);
|
||||
} else {
|
||||
Transform lineMiddleTransform = transform.FindChild("LineMiddle");
|
||||
LineRenderer lineMiddleRenderer = line1BaseTransform.GetComponent<LineRenderer>();
|
||||
LineRenderer lineMiddleRenderer = lineMiddleTransform.GetComponent<LineRenderer>();
|
||||
lineMiddleRenderer.SetWidth(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
+2
-2
@@ -1,6 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90a52fc266c12ff41ab5b486a49bcb9c
|
||||
timeCreated: 1464211843
|
||||
guid: cf1a2d53d09212446b0d9316c31c7fcb
|
||||
timeCreated: 1464306843
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
|
||||
Executable
+46
@@ -0,0 +1,46 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Outline : MonoBehaviour {
|
||||
public Material OutlineMaterial;
|
||||
|
||||
void Start() {
|
||||
OnEnable();
|
||||
}
|
||||
|
||||
void OnEnable() {
|
||||
foreach (var rend in GetComponentsInChildren<MeshRenderer>()) {
|
||||
bool end = false;
|
||||
foreach (var mat in rend.sharedMaterials) {
|
||||
if (mat == OutlineMaterial) {
|
||||
end = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (end) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var newMats = rend.materials;
|
||||
Array.Resize(ref newMats, newMats.Length + 1);
|
||||
newMats[newMats.Length - 1] = OutlineMaterial;
|
||||
rend.materials = newMats;
|
||||
}
|
||||
}
|
||||
|
||||
void OnDisable() {
|
||||
foreach (var rend in GetComponentsInChildren<MeshRenderer>()) {
|
||||
var newMats = new List<Material>();
|
||||
|
||||
foreach (var mat in rend.sharedMaterials) {
|
||||
if (mat != OutlineMaterial) {
|
||||
newMats.Add(mat);
|
||||
}
|
||||
}
|
||||
|
||||
rend.materials = newMats.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
Executable
+12
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b18ebb98b5928ab489635cfad09a0f2f
|
||||
timeCreated: 1464301950
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e580c3590072d6743a2d665776ccc971
|
||||
folderAsset: yes
|
||||
timeCreated: 1464302284
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Regular → Executable
BIN
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 90a52fc266c12ff41ab5b486a49bcb9c
|
||||
timeCreated: 1464211843
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Executable
BIN
Binary file not shown.
+8
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2060575667567594abaf4f8fa1044488
|
||||
timeCreated: 1464301808
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+53
-10
@@ -5,6 +5,9 @@ using System.Collections.Generic;
|
||||
|
||||
public class RightController : MonoBehaviour {
|
||||
public Transform MiniatureAttachmentPoint;
|
||||
public Material OutlineMaterial;
|
||||
public GameObject MainCamera;
|
||||
public GameObject WarehouseCamera;
|
||||
|
||||
SteamVR_LaserPointer laserPointer;
|
||||
SteamVR_ControllerEvents controllerEvents;
|
||||
@@ -22,6 +25,8 @@ public class RightController : MonoBehaviour {
|
||||
float whRowBaseOffset = 0.0f;
|
||||
float whRowScrollOffset = 0.0f;
|
||||
|
||||
Measurement currentMeasurement = null;
|
||||
|
||||
void Awake() {
|
||||
laserPointer = GetComponent<SteamVR_LaserPointer>();
|
||||
|
||||
@@ -30,6 +35,10 @@ public class RightController : MonoBehaviour {
|
||||
controllerEvents.TriggerUnclicked += triggerUnclicked;
|
||||
controllerEvents.TouchpadClicked += touchpadClicked;
|
||||
controllerEvents.TouchpadUnclicked += touchpadUnclicked;
|
||||
controllerEvents.ApplicationMenuClicked += applicationMenuClicked;
|
||||
controllerEvents.ApplicationMenuUnclicked += applicationMenuUnclicked;
|
||||
|
||||
boxCollider = GetComponent<BoxCollider>();
|
||||
|
||||
warehouse = GameObject.Find("Warehouse/Shelves/Column").GetComponent<WarehouseColumn>();
|
||||
}
|
||||
@@ -49,6 +58,11 @@ public class RightController : MonoBehaviour {
|
||||
warehouse.Offset = whBaseOffset + (-whScrollOffset);
|
||||
whRow.Offset = whRowBaseOffset + whRowScrollOffset;
|
||||
}
|
||||
|
||||
// Measurement
|
||||
if (currentMeasurement != null) {
|
||||
currentMeasurement.EndPosition = transform.localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
void OnTriggerEnter(Collider other) {
|
||||
@@ -57,11 +71,17 @@ public class RightController : MonoBehaviour {
|
||||
return;
|
||||
}
|
||||
|
||||
touchingItems.Add(other.gameObject);
|
||||
touchingItems.Add(mini.gameObject);
|
||||
//mini.gameObject.AddComponent<Outline>().OutlineMaterial = Resources.Load<Material>("OutLineMaterialMini");
|
||||
}
|
||||
|
||||
void OnTriggerExit(Collider other) {
|
||||
touchingItems.Remove(other.gameObject);
|
||||
var mini = other.GetComponentInParent<FurnitureMiniature>();
|
||||
if (mini == null) {
|
||||
return;
|
||||
}
|
||||
touchingItems.Remove(mini.gameObject);
|
||||
//Destroy(mini.gameObject.GetComponent<Outline>());
|
||||
}
|
||||
|
||||
// Furniture picking
|
||||
@@ -129,12 +149,15 @@ public class RightController : MonoBehaviour {
|
||||
if (warehouseItem) {
|
||||
var mini = warehouseItem.Pick();
|
||||
mini.Grab();
|
||||
mini.transform.SetParent(MiniatureAttachmentPoint, false);
|
||||
mini.transform.localPosition = Vector3.zero;
|
||||
mini.transform.localScale = Vector3.one / 10.0f;
|
||||
|
||||
var anim = mini.gameObject.AddComponent<WarehouseMiniatureAnim>();
|
||||
anim.OriginItem = warehouseItem;
|
||||
anim.DestinationAttachment = MiniatureAttachmentPoint;
|
||||
anim.GoalScale = new Vector3(0.05f, 0.05f, 0.05f);
|
||||
anim.Duration = 0.33f;
|
||||
//var anim = mini.gameObject.AddComponent<WarehouseMiniatureAnim>();
|
||||
//anim.OriginItem = warehouseItem;
|
||||
//anim.DestinationAttachment = MiniatureAttachmentPoint;
|
||||
//anim.GoalScale = new Vector3(0.1f, 0.1f, 0.1f);
|
||||
//anim.Duration = 0.33f;
|
||||
|
||||
heldItem = mini.gameObject;
|
||||
|
||||
@@ -145,11 +168,17 @@ public class RightController : MonoBehaviour {
|
||||
var furnitureMini = result.rigidbody.GetComponent<FurnitureMiniature>();
|
||||
if (furnitureMini) {
|
||||
furnitureMini.Grab();
|
||||
if (WarehouseCamera.activeSelf) {
|
||||
furnitureMini.transform.SetParent(MiniatureAttachmentPoint, true);
|
||||
furnitureMini.transform.localPosition = Vector3.zero;
|
||||
} else {
|
||||
furnitureMini.transform.SetParent(MiniatureAttachmentPoint, true);
|
||||
}
|
||||
|
||||
var anim = furnitureMini.gameObject.AddComponent<WarehouseMiniatureAnim>();
|
||||
//var anim = furnitureMini.gameObject.AddComponent<WarehouseMiniatureAnim>();
|
||||
//anim.OriginItem = furnitureMini;
|
||||
anim.DestinationAttachment = MiniatureAttachmentPoint;
|
||||
anim.Duration = 0.33f;
|
||||
//anim.DestinationAttachment = MiniatureAttachmentPoint;
|
||||
//anim.Duration = 0.33f;
|
||||
|
||||
heldItem = furnitureMini.gameObject;
|
||||
return true;
|
||||
@@ -184,4 +213,18 @@ public class RightController : MonoBehaviour {
|
||||
whScrollStartPos = null;
|
||||
}
|
||||
}
|
||||
|
||||
void applicationMenuClicked(object sender, ControllerClickedEventArgs e) {
|
||||
if (currentMeasurement == null) {
|
||||
var prefab = Resources.Load<GameObject>("Measurement");
|
||||
currentMeasurement = Instantiate(prefab).GetComponent<Measurement>();
|
||||
currentMeasurement.transform.SetParent(GameObject.Find("Scene").transform, false);
|
||||
currentMeasurement.StartPosition = transform.localPosition;
|
||||
currentMeasurement.EndPosition = transform.localPosition;
|
||||
}
|
||||
}
|
||||
|
||||
void applicationMenuUnclicked(object sender, ControllerClickedEventArgs e) {
|
||||
currentMeasurement = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class SteamVR_LaserPointer : MonoBehaviour
|
||||
void Start ()
|
||||
{
|
||||
holder = new GameObject();
|
||||
holder.transform.parent = this.transform;
|
||||
holder.transform.SetParent(transform, false);
|
||||
holder.transform.localPosition = Vector3.zero;
|
||||
|
||||
pointer = GameObject.CreatePrimitive(PrimitiveType.Cube);
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -14,7 +14,7 @@ public class WarehouseMiniatureAnim : MonoBehaviour {
|
||||
|
||||
void Start () {
|
||||
originalPos = transform.position;
|
||||
originalScale = Vector3.Scale(transform.localScale, GoalScale);
|
||||
originalScale = transform.localScale;
|
||||
}
|
||||
|
||||
void Update () {
|
||||
@@ -29,14 +29,14 @@ public class WarehouseMiniatureAnim : MonoBehaviour {
|
||||
var startPos = OriginItem ? OriginItem.transform.position : originalPos;
|
||||
transform.position = Vector3.Lerp(startPos, t2.position, alpha);
|
||||
//transform.rotation = Quaternion.Slerp(transform.rotation, t2.rotation, alpha);
|
||||
var startScale = OriginItem ? OriginItem.transform.localScale : originalScale;
|
||||
transform.localScale = Vector3.Lerp(startScale, Vector3.Scale(originalScale, t2.lossyScale), alpha);
|
||||
var startScale = OriginItem.transform.localScale;
|
||||
transform.localScale = Vector3.Lerp(startScale, Vector3.Scale(originalScale, GoalScale), alpha);
|
||||
}
|
||||
|
||||
public void End() {
|
||||
transform.SetParent(DestinationAttachment, false);
|
||||
transform.localPosition = Vector3.zero;
|
||||
transform.localScale = originalScale;
|
||||
//transform.localScale = originalScale;
|
||||
Destroy(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class WarehouseRow : MonoBehaviour {
|
||||
var i = t.GetSiblingIndex();
|
||||
var distance = (float)i / (furniture.childCount) * curve.length + Offset;
|
||||
distance = Mathf.Repeat(distance, curve.length);
|
||||
var pos = curve.GetPointAtDistance(distance);
|
||||
var pos = curve.GetUniformPointAtDistance(distance);
|
||||
t.position = pos;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -1,2 +1,2 @@
|
||||
m_EditorVersion: 5.3.5f1
|
||||
m_EditorVersion: 5.3.4f1
|
||||
m_StandardAssetsVersion: 0
|
||||
|
||||
Reference in New Issue
Block a user