mirror of
https://udrimavric.com/MAVRIC/Stratasys-Fortus-450mc.git
synced 2025-01-22 07:09:08 -05:00
Merge pull request #7 from LlamaWithOwl/feature/orbit-camera
Feature: Orbit Camera
This commit is contained in:
commit
eab8ccb8c0
File diff suppressed because it is too large
Load Diff
8
Assets/Scripts/Input.meta
Normal file
8
Assets/Scripts/Input.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d47ff5da1602bfc4f8deb5230c973c73
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
3
Assets/Scripts/Input/Cinemachine.meta
Normal file
3
Assets/Scripts/Input/Cinemachine.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f78c16008a764b039db892dd6c229d55
|
||||
timeCreated: 1690373516
|
@ -0,0 +1,47 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
namespace MAVRIC.Input
|
||||
{
|
||||
public class MAVRICCinemachineInputProvider : Cinemachine.CinemachineInputProvider
|
||||
{
|
||||
public override float GetAxisValue(int axis)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
var action = ResolveForPlayer(axis, axis == 2 ? ZAxis : XYAxis);
|
||||
if (action != null)
|
||||
{
|
||||
switch (axis)
|
||||
{
|
||||
case 0:
|
||||
return ReadXAxis(action);
|
||||
case 1:
|
||||
return ReadYAxis(action);
|
||||
case 2:
|
||||
return ReadZAxis(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected virtual float ReadXAxis(in InputAction action)
|
||||
{
|
||||
return action.ReadValue<Vector2>().x;
|
||||
}
|
||||
|
||||
protected virtual float ReadYAxis(in InputAction action)
|
||||
{
|
||||
return action.ReadValue<Vector2>().y;
|
||||
}
|
||||
|
||||
protected virtual float ReadZAxis(in InputAction action)
|
||||
{
|
||||
var inputValue = action.ReadValue<float>();
|
||||
Debug.Log($"ZAxis: {inputValue}");
|
||||
|
||||
return inputValue;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 31ec3ac7f025b4046a531484dceb935c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences:
|
||||
- XYAxis: {fileID: 5355366149960190905, guid: 60132311316fe1d4fbf004b791401886, type: 3}
|
||||
- ZAxis: {fileID: 2265345372146452755, guid: 60132311316fe1d4fbf004b791401886, type: 3}
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Scripts/UI.meta
Normal file
8
Assets/Scripts/UI.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 185abe3ead7ed39458ac3c3db107c922
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
3
Assets/Scripts/UI/Utilities.meta
Normal file
3
Assets/Scripts/UI/Utilities.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7e46dbb60c9a4ccca21c3c40e02dec39
|
||||
timeCreated: 1690370576
|
86
Assets/Scripts/UI/Utilities/UISafeArea.cs
Normal file
86
Assets/Scripts/UI/Utilities/UISafeArea.cs
Normal file
@ -0,0 +1,86 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MAVRIC.UI.Utilies
|
||||
{
|
||||
public class UISafeArea : MonoBehaviour
|
||||
{
|
||||
public bool ignoreLeft, ignoreRight, ignoreTop, ignoreBottom;
|
||||
|
||||
[SerializeField, ReadOnly] private RectTransform rectTransform;
|
||||
|
||||
private Rect currentArea;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (this.rectTransform is null)
|
||||
{
|
||||
GetComponents();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
UpdateUI(true);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
UpdateUI();
|
||||
}
|
||||
|
||||
private void GetComponents()
|
||||
{
|
||||
TryGetComponent(out this.rectTransform);
|
||||
}
|
||||
|
||||
public void UpdateUI(bool forceUpdate = false)
|
||||
{
|
||||
UpdateRectSize(Screen.safeArea, forceUpdate);
|
||||
}
|
||||
|
||||
private void UpdateRectSize(Rect area, bool forceUpdate = false)
|
||||
{
|
||||
if (this.rectTransform is null) return;
|
||||
if (forceUpdate is false && currentArea == area) return;
|
||||
|
||||
var anchorMin = area.position;
|
||||
var anchorMax = area.position + area.size;
|
||||
|
||||
anchorMin.x /= Screen.width;
|
||||
anchorMin.y /= Screen.height;
|
||||
anchorMax.x /= Screen.width;
|
||||
anchorMax.y /= Screen.height;
|
||||
|
||||
if (ignoreLeft)
|
||||
{
|
||||
anchorMin.x = 0f;
|
||||
}
|
||||
|
||||
if (ignoreRight)
|
||||
{
|
||||
anchorMax.x = 1f;
|
||||
}
|
||||
|
||||
if (ignoreTop)
|
||||
{
|
||||
anchorMax.y = 1f;
|
||||
}
|
||||
|
||||
if (ignoreBottom)
|
||||
{
|
||||
anchorMin.y = 0f;
|
||||
}
|
||||
|
||||
rectTransform.anchoredPosition = Vector2.zero;
|
||||
rectTransform.sizeDelta = Vector2.zero;
|
||||
rectTransform.anchorMin = anchorMin;
|
||||
rectTransform.anchorMax = anchorMax;
|
||||
|
||||
currentArea = area;
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/UI/Utilities/UISafeArea.cs.meta
Normal file
11
Assets/Scripts/UI/Utilities/UISafeArea.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 168fc1abe5906ee408df7120f6e4124a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Settings.meta
Normal file
8
Assets/Settings.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd38190998cdd4d41853c992c027e50b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Assets/Settings/Input.meta
Normal file
8
Assets/Settings/Input.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 19aec48db6761764a91e3971485ef364
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
137
Assets/Settings/Input/GeneralInput.inputactions
Normal file
137
Assets/Settings/Input/GeneralInput.inputactions
Normal file
@ -0,0 +1,137 @@
|
||||
{
|
||||
"name": "GeneralInput",
|
||||
"maps": [
|
||||
{
|
||||
"name": "Player",
|
||||
"id": "a648116e-30a4-4385-b1b3-c68313a99118",
|
||||
"actions": [
|
||||
{
|
||||
"name": "Look",
|
||||
"type": "Value",
|
||||
"id": "66b1943a-5f5d-4468-8927-cf27d673a48d",
|
||||
"expectedControlType": "Vector2",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
},
|
||||
{
|
||||
"name": "Zoom",
|
||||
"type": "Value",
|
||||
"id": "629b760e-aea2-43b1-bab8-82a63af8926a",
|
||||
"expectedControlType": "Analog",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": true
|
||||
}
|
||||
],
|
||||
"bindings": [
|
||||
{
|
||||
"name": "",
|
||||
"id": "89a12f40-df5f-4fb3-9b97-2c0e44d94221",
|
||||
"path": "<Gamepad>/rightStick",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Gamepad",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "One Modifier",
|
||||
"id": "6e497863-3638-48e9-9613-117acaa7fa74",
|
||||
"path": "OneModifier",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Look",
|
||||
"isComposite": true,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "modifier",
|
||||
"id": "850418d7-0e8a-4c18-97af-84abbc55a230",
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "binding",
|
||||
"id": "c975f272-be60-4cb0-9ca7-9a0314601f4c",
|
||||
"path": "<Pointer>/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": true
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "e5cbb455-b6d3-4a9c-a4a2-7188510d7aa4",
|
||||
"path": "<Touchscreen>/primaryTouch/delta",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Touch",
|
||||
"action": "Look",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "ed328ea2-92b4-4229-9fbc-16aad7be7d70",
|
||||
"path": "<Mouse>/scroll/y",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "Zoom",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"controlSchemes": [
|
||||
{
|
||||
"name": "Keyboard&Mouse",
|
||||
"bindingGroup": "Keyboard&Mouse",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Keyboard>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
},
|
||||
{
|
||||
"devicePath": "<Mouse>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Gamepad",
|
||||
"bindingGroup": "Gamepad",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Gamepad>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "Touch",
|
||||
"bindingGroup": "Touch",
|
||||
"devices": [
|
||||
{
|
||||
"devicePath": "<Touchscreen>",
|
||||
"isOptional": false,
|
||||
"isOR": false
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
14
Assets/Settings/Input/GeneralInput.inputactions.meta
Normal file
14
Assets/Settings/Input/GeneralInput.inputactions.meta
Normal file
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 60132311316fe1d4fbf004b791401886
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 8404be70184654265930450def6a9037, type: 3}
|
||||
generateWrapperCode: 0
|
||||
wrapperCodePath:
|
||||
wrapperClassName:
|
||||
wrapperCodeNamespace:
|
@ -26,6 +26,7 @@
|
||||
"com.microsoft.mrtk.uxcore": "file:MixedReality/com.microsoft.mrtk.uxcore-3.0.0-pre.16.tgz",
|
||||
"com.microsoft.mrtk.windowsspeech": "file:MixedReality/com.microsoft.mrtk.windowsspeech-3.0.0-pre.16.tgz",
|
||||
"com.microsoft.spatialaudio.spatializer.unity": "file:MixedReality/com.microsoft.spatialaudio.spatializer.unity-2.0.37.tgz",
|
||||
"com.unity.cinemachine": "2.9.7",
|
||||
"com.unity.feature.development": "1.0.1",
|
||||
"com.unity.netcode.gameobjects": "1.5.1",
|
||||
"com.unity.textmeshpro": "3.0.6",
|
||||
|
@ -159,6 +159,15 @@
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.cinemachine": {
|
||||
"version": "2.9.7",
|
||||
"depth": 0,
|
||||
"source": "registry",
|
||||
"dependencies": {
|
||||
"com.unity.test-framework": "1.1.31"
|
||||
},
|
||||
"url": "https://packages.unity.com"
|
||||
},
|
||||
"com.unity.collections": {
|
||||
"version": "1.2.4",
|
||||
"depth": 2,
|
||||
|
Loading…
Reference in New Issue
Block a user