Change default knuckle binding

This commit is contained in:
Legonzaur 2023-01-17 12:11:57 +01:00
parent 25473c4936
commit 7c200b5865
10 changed files with 444 additions and 345 deletions

View File

@ -0,0 +1,80 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: wood
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: dfb21938bf3e6e3a1a1efe55f9294ac0, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 420418e3480c5d948870e1e5997e7817
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -13,7 +13,7 @@ ModelImporter:
type: UnityEngine:Material
assembly: UnityEngine.CoreModule
name: wood
second: {fileID: 2100000, guid: 5dce1f8fd86e04f42a922b7a3ce2a2a7, type: 2}
second: {fileID: 2100000, guid: 420418e3480c5d948870e1e5997e7817, type: 2}
materials:
materialImportMode: 2
materialName: 0

View File

@ -61,7 +61,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 5dce1f8fd86e04f42a922b7a3ce2a2a7, type: 2}
- {fileID: 2100000, guid: 420418e3480c5d948870e1e5997e7817, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -109,7 +109,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 817123034334832562}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 0.7, z: 0.03}
m_ConstrainProportionsScale: 0
m_Children: []
@ -144,7 +144,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 5dce1f8fd86e04f42a922b7a3ce2a2a7, type: 2}
- {fileID: 2100000, guid: 420418e3480c5d948870e1e5997e7817, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -428,7 +428,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2884046772418411006}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 0.7, z: 0.03}
m_ConstrainProportionsScale: 0
m_Children: []
@ -463,7 +463,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 5dce1f8fd86e04f42a922b7a3ce2a2a7, type: 2}
- {fileID: 2100000, guid: 420418e3480c5d948870e1e5997e7817, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -677,7 +677,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6640510962220684130}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 0.7, z: 0.03}
m_ConstrainProportionsScale: 0
m_Children: []
@ -712,7 +712,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 5dce1f8fd86e04f42a922b7a3ce2a2a7, type: 2}
- {fileID: 2100000, guid: 420418e3480c5d948870e1e5997e7817, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
@ -760,7 +760,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8712456045789040059}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 0.7, z: 0.03}
m_ConstrainProportionsScale: 0
m_Children: []
@ -795,7 +795,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 5dce1f8fd86e04f42a922b7a3ce2a2a7, type: 2}
- {fileID: 2100000, guid: 420418e3480c5d948870e1e5997e7817, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0

View File

@ -5,6 +5,7 @@ using System.Runtime.CompilerServices;
using UnityEditor;
using UnityEngine;
using UnityEngine.ProBuilder.Shapes;
using UnityEngine.XR;
using Valve.VR.InteractionSystem;
public class Catalog : MonoBehaviour
@ -17,7 +18,7 @@ public class Catalog : MonoBehaviour
private GameObject spherePrefab;
private Vector3 sphereReturn;
private GameObject currentSphere;
public List<GameObject> Furnitures;
private int maxShownObjects;
// Start is called before the first frame update
@ -81,12 +82,34 @@ public class Catalog : MonoBehaviour
}
}
public void GrabObject(GameObject furniture, Hand hand)
public void GrabObject(GameObject furniture, Valve.VR.InteractionSystem.Hand hand)
{
var sphere = Instantiate(spherePrefab);
sphere.transform.localScale = Vector3.one * objectScale;
GameObject furrnitureBall = Instantiate(furniture);
furrnitureBall.transform.parent = sphere.transform;
Furniture objectBounds = furrnitureBall.GetComponent<Furniture>();
if (!objectBounds)
{
objectBounds = furrnitureBall.AddComponent<Furniture>();
}
objectBounds.CalculateBounds();
float rescale = (objectScale / 1.4f) / objectBounds.combinedBounds.size.magnitude;
furrnitureBall.transform.localScale *= rescale;
furrnitureBall.transform.localPosition = Vector3.down * 0.2f;
sphere.SetActive(true);
hand.GetGrabStarting
hand.AttachObject(sphere, GrabTypes.Trigger);
currentSphere = sphere;
}
public void ReleaseObject(GameObject furniture, Valve.VR.InteractionSystem.Hand hand)
{
hand.DetachObject(currentSphere);
currentSphere = null;
}
private void OnDrawGizmosSelected()
@ -102,14 +125,14 @@ public class Catalog : MonoBehaviour
}
public void OnGrabSphere(GameObject sphere)
public void OnGrabSphere(CatalogElement sphere)
{
}
public void OnReleaseSphere(GameObject sphere)
public void OnReleaseSphere(CatalogElement sphere, Valve.VR.InteractionSystem.Hand hand)
{
hand.DetachObject(sphere.gameObject);
}

View File

@ -26,7 +26,8 @@ public class CatalogElement : MonoBehaviour
public void OnReleaseSphere()
{
StartCoroutine(ReturnSphere());
//StartCoroutine(ReturnSphere());
//Destroy(gameObject);
}
private IEnumerator ReturnSphere()

View File

@ -3,6 +3,7 @@ using UnityEngine;
using UnityEngine.EventSystems;
using Valve.VR;
using Valve.VR.Extras;
using Valve.VR.InteractionSystem;
public class FurnitureMover : MonoBehaviour
{
@ -128,7 +129,12 @@ public class FurnitureMover : MonoBehaviour
}
public void GrabFurniture(GameObject furniture)
{
//Catalog.Instance.GrabObject(furniture, gameObject.GetComponent<Hand>());
Catalog.Instance.GrabObject(furniture, gameObject.GetComponent<Hand>());
}
public void ReleaseFurniture(GameObject furniture)
{
Catalog.Instance.ReleaseObject(furniture, gameObject.GetComponent<Hand>());
}
private void OnPointerClickDown(object sender, PointerEventArgs e)
{

View File

@ -1,325 +1,317 @@
{
"bindings" : {
"/actions/buggy" : {
"sources" : [
{
"inputs" : {
"position" : {
"output" : "/actions/buggy/in/steering"
}
},
"mode" : "joystick",
"path" : "/user/hand/left/input/thumbstick"
},
{
"inputs" : {
"position" : {
"output" : "/actions/buggy/in/steering"
}
},
"mode" : "joystick",
"path" : "/user/hand/right/input/thumbstick"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/buggy/in/throttle"
}
},
"mode" : "trigger",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"pull" : {
"output" : "/actions/buggy/in/throttle"
}
},
"mode" : "trigger",
"path" : "/user/hand/right/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/buggy/in/brake"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/a"
},
{
"inputs" : {
"click" : {
"output" : "/actions/buggy/in/brake"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/a"
},
{
"inputs" : {
"click" : {
"output" : "/actions/buggy/in/reset"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/b"
},
{
"inputs" : {
"click" : {
"output" : "/actions/buggy/in/reset"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/b"
"/actions/buggy": {
"sources": [
{
"path": "/user/hand/left/input/thumbstick",
"mode": "joystick",
"inputs": {
"position": {
"output": "/actions/buggy/in/steering"
}
]
},
"/actions/default" : {
"chords" : [],
"haptics" : [
{
"output" : "/actions/default/out/haptic",
"path" : "/user/hand/left/output/haptic"
},
{
"output" : "/actions/default/out/haptic",
"path" : "/user/hand/right/output/haptic"
}
],
"poses" : [
{
"output" : "/actions/default/in/pose",
"path" : "/user/hand/left/pose/raw"
},
{
"output" : "/actions/default/in/pose",
"path" : "/user/hand/right/pose/raw"
}
],
"skeleton" : [
{
"output" : "/actions/default/in/skeletonlefthand",
"path" : "/user/hand/left/input/skeleton/left"
},
{
"output" : "/actions/default/in/skeletonrighthand",
"path" : "/user/hand/right/input/skeleton/right"
}
],
"sources": [
{
"inputs": {
"click": {
"output": "/actions/default/in/interactui"
}
},
"mode": "button",
"path": "/user/hand/left/input/trigger"
},
{
"inputs": {
"force": {
"output": "/actions/default/in/squeeze"
}
},
"mode": "force_sensor",
"path": "/user/hand/left/input/grip"
},
{
"inputs": {
"force": {
"output": "/actions/default/in/squeeze"
}
},
"mode": "force_sensor",
"path": "/user/hand/right/input/grip"
},
{
"inputs": {
"click": {
"output": "/actions/default/in/teleport"
}
},
"mode": "button",
"path": "/user/hand/left/input/trackpad"
},
{
"inputs": {
"click": {
"output": "/actions/default/in/interactui"
}
},
"mode": "button",
"path": "/user/hand/right/input/trigger"
},
{
"inputs": {
"click": {
"output": "/actions/default/in/teleport"
}
},
"mode": "button",
"path": "/user/hand/right/input/trackpad"
},
{
"inputs": {
"north": {
"output": "/actions/default/in/teleport"
}
},
"mode": "dpad",
"parameters": {
"deadzone_pct": "25",
"overlap_pct": "30",
"sub_mode": "touch"
},
"path": "/user/hand/left/input/thumbstick"
},
{
"inputs": {
"north": {
"output": "/actions/default/in/teleport"
}
},
"mode": "dpad",
"parameters": {
"deadzone_pct": "25",
"overlap_pct": "30",
"sub_mode": "touch"
},
"path": "/user/hand/right/input/thumbstick"
},
{
"inputs": {
"east": {
"output": "/actions/default/in/snapturnright"
},
"west": {
"output": "/actions/default/in/snapturnleft"
}
},
"mode": "dpad",
"parameters": {
"deadzone_pct": "85",
"overlap_pct": "0",
"sub_mode": "touch"
},
"path": "/user/hand/left/input/thumbstick"
},
{
"inputs": {
"east": {
"output": "/actions/default/in/snapturnright"
},
"west": {
"output": "/actions/default/in/snapturnleft"
}
},
"mode": "dpad",
"parameters": {
"deadzone_pct": "85",
"overlap_pct": "0",
"sub_mode": "touch"
},
"path": "/user/hand/right/input/thumbstick"
},
{
"inputs": {
"grab": {
"output": "/actions/default/in/grabgrip"
}
},
"mode": "grab",
"parameters": {
"force_hold_threshold": "0.02",
"force_release_threshold": "0.01"
},
"path": "/user/hand/left/input/grip"
},
{
"inputs": {
"grab": {
"output": "/actions/default/in/grabgrip"
}
},
"mode": "grab",
"parameters": {
"force_hold_threshold": "0.02",
"force_release_threshold": "0.01"
},
"path": "/user/hand/right/input/grip"
},
{
"inputs": {
"grab": {
"output": "/actions/default/in/grabpinch"
}
},
"mode": "grab",
"parameters": {
"force_hold_threshold": "0.02",
"force_release_threshold": "0.01"
},
"path": "/user/hand/left/input/pinch"
},
{
"inputs": {
"grab": {
"output": "/actions/default/in/grabpinch"
}
},
"mode": "grab",
"parameters": {
"force_hold_threshold": "0.02",
"force_release_threshold": "0.01"
},
"path": "/user/hand/right/input/pinch"
}
]
},
"/actions/platformer" : {
"sources" : [
{
"inputs" : {
"position" : {
"output" : "/actions/platformer/in/move"
}
},
"mode" : "joystick",
"path" : "/user/hand/left/input/thumbstick"
},
{
"inputs" : {
"position" : {
"output" : "/actions/platformer/in/move"
}
},
"mode" : "joystick",
"path" : "/user/hand/right/input/thumbstick"
},
{
"inputs" : {
"click" : {
"output" : "/actions/platformer/in/jump"
}
},
"mode" : "button",
"path" : "/user/hand/left/input/trigger"
},
{
"inputs" : {
"click" : {
"output" : "/actions/platformer/in/jump"
}
},
"mode" : "button",
"path" : "/user/hand/right/input/trigger"
},
{
"path": "/user/hand/right/input/thumbstick",
"mode": "joystick",
"inputs": {
"position": {
"output": "/actions/buggy/in/steering"
}
]
}
},
}
},
{
"path": "/user/hand/left/input/trigger",
"mode": "trigger",
"inputs": {
"pull": {
"output": "/actions/buggy/in/throttle"
}
}
},
{
"path": "/user/hand/right/input/trigger",
"mode": "trigger",
"inputs": {
"pull": {
"output": "/actions/buggy/in/throttle"
}
}
},
{
"path": "/user/hand/left/input/a",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/buggy/in/brake"
}
}
},
{
"path": "/user/hand/right/input/a",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/buggy/in/brake"
}
}
},
{
"path": "/user/hand/left/input/b",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/buggy/in/reset"
}
}
},
{
"path": "/user/hand/right/input/b",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/buggy/in/reset"
}
}
}
]
},
"/actions/default": {
"chords": [],
"poses": [
{
"output": "/actions/default/in/pose",
"path": "/user/hand/left/pose/raw"
},
{
"output": "/actions/default/in/pose",
"path": "/user/hand/right/pose/raw"
}
],
"haptics": [
{
"output": "/actions/default/out/haptic",
"path": "/user/hand/left/output/haptic"
},
{
"output": "/actions/default/out/haptic",
"path": "/user/hand/right/output/haptic"
}
],
"sources": [
{
"path": "/user/hand/left/input/trigger",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/default/in/interactui"
}
}
},
{
"path": "/user/hand/left/input/grip",
"mode": "force_sensor",
"inputs": {
"force": {
"output": "/actions/default/in/squeeze"
}
}
},
{
"path": "/user/hand/right/input/grip",
"mode": "force_sensor",
"inputs": {
"force": {
"output": "/actions/default/in/squeeze"
}
}
},
{
"path": "/user/hand/left/input/trackpad",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/default/in/teleport"
}
}
},
{
"path": "/user/hand/right/input/trigger",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/default/in/interactui"
}
}
},
{
"path": "/user/hand/right/input/trackpad",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/default/in/teleport"
}
}
},
{
"path": "/user/hand/left/input/thumbstick",
"mode": "dpad",
"parameters": {
"deadzone_pct": "25",
"overlap_pct": "30",
"sub_mode": "touch"
},
"inputs": {
"north": {
"output": "/actions/default/in/teleport"
}
}
},
{
"path": "/user/hand/right/input/thumbstick",
"mode": "dpad",
"parameters": {
"deadzone_pct": "25",
"overlap_pct": "30",
"sub_mode": "touch"
},
"inputs": {
"north": {
"output": "/actions/default/in/teleport"
}
}
},
{
"path": "/user/hand/left/input/thumbstick",
"mode": "dpad",
"parameters": {
"deadzone_pct": "85",
"overlap_pct": "0",
"sub_mode": "touch"
},
"inputs": {
"east": {
"output": "/actions/default/in/snapturnright"
},
"west": {
"output": "/actions/default/in/snapturnleft"
}
}
},
{
"path": "/user/hand/right/input/thumbstick",
"mode": "dpad",
"parameters": {
"deadzone_pct": "85",
"overlap_pct": "0",
"sub_mode": "touch"
},
"inputs": {
"east": {
"output": "/actions/default/in/snapturnright"
},
"west": {
"output": "/actions/default/in/snapturnleft"
}
}
},
{
"path": "/user/hand/left/input/grip",
"mode": "grab",
"parameters": {
"force_hold_threshold": "0.02",
"force_release_threshold": "0.01"
},
"inputs": {
"grab": {
"output": "/actions/default/in/grabgrip"
}
}
},
{
"path": "/user/hand/right/input/grip",
"mode": "grab",
"parameters": {
"force_hold_threshold": "0.02",
"force_release_threshold": "0.01"
},
"inputs": {
"grab": {
"output": "/actions/default/in/grabgrip"
}
}
},
{
"path": "/user/hand/left/input/trigger",
"mode": "trigger",
"inputs": {
"click": {
"output": "/actions/default/in/grabgrip"
}
}
},
{
"path": "/user/hand/right/input/trigger",
"mode": "trigger",
"inputs": {
"click": {
"output": "/actions/default/in/grabgrip"
}
}
}
],
"skeleton": [
{
"output": "/actions/default/in/skeletonlefthand",
"path": "/user/hand/left/input/skeleton/left"
},
{
"output": "/actions/default/in/skeletonrighthand",
"path": "/user/hand/right/input/skeleton/right"
}
]
},
"/actions/platformer": {
"sources": [
{
"path": "/user/hand/left/input/thumbstick",
"mode": "joystick",
"inputs": {
"position": {
"output": "/actions/platformer/in/move"
}
}
},
{
"path": "/user/hand/right/input/thumbstick",
"mode": "joystick",
"inputs": {
"position": {
"output": "/actions/platformer/in/move"
}
}
},
{
"path": "/user/hand/left/input/trigger",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/platformer/in/jump"
}
}
},
{
"path": "/user/hand/right/input/trigger",
"mode": "button",
"inputs": {
"click": {
"output": "/actions/platformer/in/jump"
}
}
}
]
}
},
"controller_type" : "knuckles",
"description" : "",
"name" : "knuckles_default"

View File

@ -14,7 +14,6 @@
"com.unity.toolchain.linux-x86_64": "2.0.4",
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.4",
"com.unity.ugui": "1.0.0",
"com.unity.visualscripting": "1.7.8",
"com.unity.xr.management": "4.3.1",
"com.unity.xr.openxr": "1.5.3",
"com.valvesoftware.unity.openvr": "file:../Assets/SteamVR/OpenVRUnityXRPackage/Editor/com.valvesoftware.unity.openvr-1.1.4.tgz",

View File

@ -224,16 +224,6 @@
"com.unity.modules.imgui": "1.0.0"
}
},
"com.unity.visualscripting": {
"version": "1.7.8",
"depth": 0,
"source": "registry",
"dependencies": {
"com.unity.ugui": "1.0.0",
"com.unity.modules.jsonserialize": "1.0.0"
},
"url": "https://packages.unity.com"
},
"com.unity.xr.legacyinputhelpers": {
"version": "2.1.10",
"depth": 1,