deltavr multiplayer 2.0
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -73,3 +73,7 @@ crashlytics-build.properties
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa.meta
|
||||
/[Aa]ssets/[Ss]treamingAssets/aa/*
|
||||
Recordings/
|
||||
|
||||
# Paid assets
|
||||
/[Aa]ssets/Magic Light Probes/*
|
||||
/[Aa]ssets/[Bb]akery/*
|
||||
56
.vscode/settings.json
vendored
56
.vscode/settings.json
vendored
@@ -1,56 +0,0 @@
|
||||
{
|
||||
"files.exclude":
|
||||
{
|
||||
"**/.DS_Store":true,
|
||||
"**/.git":true,
|
||||
"**/.gitignore":true,
|
||||
"**/.gitmodules":true,
|
||||
"**/*.booproj":true,
|
||||
"**/*.pidb":true,
|
||||
"**/*.suo":true,
|
||||
"**/*.user":true,
|
||||
"**/*.userprefs":true,
|
||||
"**/*.unityproj":true,
|
||||
"**/*.dll":true,
|
||||
"**/*.exe":true,
|
||||
"**/*.pdf":true,
|
||||
"**/*.mid":true,
|
||||
"**/*.midi":true,
|
||||
"**/*.wav":true,
|
||||
"**/*.gif":true,
|
||||
"**/*.ico":true,
|
||||
"**/*.jpg":true,
|
||||
"**/*.jpeg":true,
|
||||
"**/*.png":true,
|
||||
"**/*.psd":true,
|
||||
"**/*.tga":true,
|
||||
"**/*.tif":true,
|
||||
"**/*.tiff":true,
|
||||
"**/*.3ds":true,
|
||||
"**/*.3DS":true,
|
||||
"**/*.fbx":true,
|
||||
"**/*.FBX":true,
|
||||
"**/*.lxo":true,
|
||||
"**/*.LXO":true,
|
||||
"**/*.ma":true,
|
||||
"**/*.MA":true,
|
||||
"**/*.obj":true,
|
||||
"**/*.OBJ":true,
|
||||
"**/*.asset":true,
|
||||
"**/*.cubemap":true,
|
||||
"**/*.flare":true,
|
||||
"**/*.mat":true,
|
||||
"**/*.meta":true,
|
||||
"**/*.prefab":true,
|
||||
"**/*.unity":true,
|
||||
"build/":true,
|
||||
"Build/":true,
|
||||
"Library/":true,
|
||||
"library/":true,
|
||||
"obj/":true,
|
||||
"Obj/":true,
|
||||
"ProjectSettings/":true,
|
||||
"temp/":true,
|
||||
"Temp/":true
|
||||
}
|
||||
}
|
||||
45
Assets/ActivateTeleportationRay.cs
Normal file
45
Assets/ActivateTeleportationRay.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.XR.Interaction.Toolkit;
|
||||
|
||||
public class ActivateTeleportationRay : MonoBehaviour
|
||||
{
|
||||
public GameObject teleportRay;
|
||||
public float rayHideDelay = 0.1f;
|
||||
|
||||
public InputActionProperty activateTeleportRay;
|
||||
public TeleportationProvider teleportationProvider;
|
||||
|
||||
// Update is called once per frame
|
||||
private void Start()
|
||||
{
|
||||
teleportRay.SetActive(false);
|
||||
activateTeleportRay.action.performed += ShowRay;
|
||||
activateTeleportRay.action.canceled += HideRayPerformed;
|
||||
teleportationProvider.endLocomotion += HideRayPerformed;
|
||||
}
|
||||
|
||||
private void HideRayPerformed(InputAction.CallbackContext obj)
|
||||
{
|
||||
if (!teleportRay.activeSelf) return;
|
||||
if (IsInvoking(nameof(HideRay))) return;
|
||||
Invoke(nameof(HideRay), rayHideDelay);
|
||||
}
|
||||
|
||||
private void HideRayPerformed(LocomotionSystem obj)
|
||||
{
|
||||
if (!teleportRay.activeSelf) return;
|
||||
if (IsInvoking(nameof(HideRay))) return;
|
||||
Invoke(nameof(HideRay), rayHideDelay);
|
||||
}
|
||||
|
||||
private void ShowRay(InputAction.CallbackContext obj)
|
||||
{
|
||||
teleportRay.SetActive(true);
|
||||
}
|
||||
|
||||
private void HideRay()
|
||||
{
|
||||
teleportRay.SetActive(false);
|
||||
}
|
||||
}
|
||||
11
Assets/ActivateTeleportationRay.cs.meta
Normal file
11
Assets/ActivateTeleportationRay.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9a0cd93f35359040bf696149b914da4
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
107
Assets/Billboard.cs
Normal file
107
Assets/Billboard.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class Billboard : MonoBehaviour
|
||||
{
|
||||
private GameObject _parent;
|
||||
public string defaultText = "Sample Text";
|
||||
public TMP_Text tmpText;
|
||||
public Canvas canvas;
|
||||
public string prefix = "<mark=#000000BB>";
|
||||
private Camera _camera;
|
||||
|
||||
public LineRenderer lineRenderer;
|
||||
public Transform lineStart;
|
||||
|
||||
private GameObject _lineEndObject;
|
||||
private MeshFilter _lineEndMeshFilter;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_camera = Camera.main;
|
||||
lineRenderer = GetComponent<LineRenderer>();
|
||||
_parent = transform.parent.gameObject;
|
||||
transform.SetParent(null);
|
||||
tmpText.text = defaultText;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (canvas.enabled) transform.position = _parent.transform.position + (_camera.transform.up * 0.1f);
|
||||
if (!lineRenderer.enabled) return;
|
||||
|
||||
lineRenderer.SetPosition(0, lineStart.position);
|
||||
lineRenderer.SetPosition(1, CalculateLineEndPosition());
|
||||
}
|
||||
|
||||
private void SetText(string txt)
|
||||
{
|
||||
tmpText.text = prefix + txt;
|
||||
}
|
||||
|
||||
|
||||
private void ShowCanvas()
|
||||
{
|
||||
canvas.enabled = true;
|
||||
lineRenderer.enabled = true;
|
||||
}
|
||||
|
||||
private void HideCanvas()
|
||||
{
|
||||
canvas.enabled = false;
|
||||
lineRenderer.enabled = false;
|
||||
}
|
||||
|
||||
public void ShowHint(string txt)
|
||||
{
|
||||
ShowCanvas();
|
||||
SetText(txt);
|
||||
}
|
||||
|
||||
public void HideHint()
|
||||
{
|
||||
HideCanvas();
|
||||
}
|
||||
|
||||
public void SetLineTarget(GameObject newGM)
|
||||
{
|
||||
_lineEndObject = newGM;
|
||||
_lineEndMeshFilter = _lineEndObject.GetComponent<MeshFilter>();
|
||||
}
|
||||
|
||||
private Vector3 CalculateLineEndPosition()
|
||||
{
|
||||
if (_lineEndObject == null)
|
||||
{
|
||||
lineRenderer.enabled = false;
|
||||
return Vector3.zero;
|
||||
}
|
||||
return _lineEndMeshFilter == null ? _lineEndObject.transform.position : FindClosestVertexToTargetPoint(lineStart.position, _lineEndMeshFilter);
|
||||
}
|
||||
|
||||
private Vector3 FindClosestVertexToTargetPoint(Vector3 start, MeshFilter filter)
|
||||
{
|
||||
// Get the Mesh object from the MeshFilter component
|
||||
Mesh mesh = filter.mesh;
|
||||
// Get the world position of the point you want to find the closest point on the mesh to
|
||||
// Transform the point into local space relative to the MeshFilter's transform
|
||||
Vector3 localPoint = filter.transform.InverseTransformPoint(start);
|
||||
|
||||
// Find the closest vertex to the point
|
||||
float closestDistance = Mathf.Infinity;
|
||||
Vector3 closestVertex = Vector3.zero;
|
||||
for (int i = 0; i < mesh.vertexCount; i++)
|
||||
{
|
||||
Vector3 vertex = mesh.vertices[i];
|
||||
float distance = Vector3.Distance(localPoint, vertex);
|
||||
if (distance < closestDistance)
|
||||
{
|
||||
closestDistance = distance;
|
||||
closestVertex = vertex;
|
||||
}
|
||||
}
|
||||
|
||||
// Transform the closest vertex back into world space
|
||||
return filter.transform.TransformPoint(closestVertex);
|
||||
}
|
||||
}
|
||||
11
Assets/Billboard.cs.meta
Normal file
11
Assets/Billboard.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 579b0d81f2e914541899696ba12066cc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -1,91 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e61fd46af9c1f040b404e6d9b3cf24f
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 10
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||