first commit

This commit is contained in:
2026-04-07 03:14:32 +03:00
commit b3992fec6b
1026 changed files with 366769 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bad58d078e8b5d84eb3e77bf43a41e82
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
%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: DarkM_Gleechi_Glass
m_Shader: {fileID: 4800000, guid: 60ebb9c34c421e141b021f0d536df52c, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _diffuse_HDR:
m_Texture: {fileID: 8900000, guid: c0b0b1f1aedd67146b49597adac5cb37, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _reflection_HDR:
m_Texture: {fileID: 8900000, guid: 1070563d294b8e34894babab8f433d44, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _a1: 0
- _a2: 1.34
- _p: 177.1
- _t: 0.438
m_Colors:
- _c: {r: 1, g: 0.7241974, b: 0, a: 1}
m_BuildTextureStacks: []

View File

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

View File

@@ -0,0 +1,39 @@
%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: M_Gleechi_Apple
m_Shader: {fileID: 4800000, guid: 8de65bf60aa6c4f4caacbc6b0880fc35, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 2800000, guid: 7d791f3ea91d49d4598753fefee584a0, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _diffuse:
m_Texture: {fileID: 8900000, guid: 19f9d995d6b8b124388e69e60e777d60, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _diffuse_HDR:
m_Texture: {fileID: 8900000, guid: 1070563d294b8e34894babab8f433d44, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _con: 6.33
m_Colors: []
m_BuildTextureStacks: []

View File

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

View File

@@ -0,0 +1,43 @@
%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: M_Gleechi_Glass
m_Shader: {fileID: 4800000, guid: 60ebb9c34c421e141b021f0d536df52c, type: 3}
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _diffuse_HDR:
m_Texture: {fileID: 8900000, guid: d4cf51e14ee745c4fa60c6aea9314226, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _reflection_HDR:
m_Texture: {fileID: 8900000, guid: 1070563d294b8e34894babab8f433d44, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _a1: 0
- _a2: 1.34
- _p: 177.1
- _t: 0.438
m_Colors:
- _c: {r: 1, g: 0.7241974, b: 0, a: 1}
m_BuildTextureStacks: []

View File

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

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0ce7064b74bf9c24fa3554bcffa34fad
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a73e1f5f06e95e743ac4b7589449a290
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: c0b0b1f1aedd67146b49597adac5cb37
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 1
seamlessCubemap: 1
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 2
aniso: 0
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 100
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
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: Server
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: Android
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: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 802d70fea3a2c28449f3b1176e28bc61
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,130 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
/**
* AssembleArticulationBody shows as a tutorial on how to use VG to
* assemble and dissemble objects through Unity's ArticulationBody.
*/
[LIBVIRTUALGRASP_UNITY_SCRIPT]
[HelpURL("https://docs.virtualgrasp.com/unity_vgonboarding_task4." + VG_Version.__VG_VERSION__ + ".html")]
public class AssembleArticulationBody : MonoBehaviour
{
public Transform m_newParent = null;
public Transform m_desiredPose = null;
public float m_assembleDistance = 0.05f;
public float m_disassembleDistance = 0.5f;
public ArticulationJointType m_jointType = ArticulationJointType.FixedJoint;
public bool m_matchAnchors = true;
public Vector3 m_anchorPosition = Vector3.zero;
public Vector3 m_anchorRotation = Vector3.zero;
public Vector3 m_parentAnchorPosition = Vector3.zero;
public Vector3 m_parentAnchorRotation = Vector3.zero;
public AudioSource m_turnWheelEffect;
private ArticulationBody m_this_ab;
private ArticulationBody m_parent_ab;
private float timeAtDisassemble = 0.0F;
private float assembleDelay = 1.0F;
private float m_state = 0;
void Start()
{
gameObject.TryGetComponent<ArticulationBody>(out m_this_ab);
if (m_newParent != null)
{
if (!m_newParent.TryGetComponent<ArticulationBody>(out m_parent_ab))
{
Debug.LogWarning("New parent " + m_newParent.name + " should have Articulation Body component, will add one in script");
m_parent_ab = m_newParent.gameObject.AddComponent<ArticulationBody>();
}
}
else
Debug.LogError("Need to specify assembling New Parent!");
// Uncomment for sound effect
if (m_turnWheelEffect != null)
InvokeRepeating("turnWheelEffect", 0.0F, .5F);
}
void LateUpdate()
{
assembleArticulationBody();
dissembleArticluationBody();
}
void assembleArticulationBody()
{
if (m_this_ab == null || m_parent_ab == null)
{
Debug.LogError("Object do no have articulation body, so can't do articulation body based assembling!");
return;
}
if ((Time.realtimeSinceStartup - timeAtDisassemble) > assembleDelay
&& (m_desiredPose.position - transform.position).magnitude < m_assembleDistance
&& transform.parent != m_newParent)
{
m_desiredPose.gameObject.SetActive(false);
// Project object rotation axis to align to desired rotation axis.
transform.SetPositionAndRotation(m_desiredPose.position, Quaternion.LookRotation(m_desiredPose.forward, transform.up));
transform.SetParent(m_newParent);
m_this_ab.jointType = m_jointType;
#if UNITY_2021_2_OR_NEWER
m_this_ab.matchAnchors = m_matchAnchors;
#elif UNITY_2021_1
m_this_ab.computeParentAnchor = m_matchAnchors;
#endif
m_this_ab.anchorPosition = m_anchorPosition;
m_this_ab.anchorRotation = Quaternion.Euler(m_anchorRotation);
m_this_ab.parentAnchorPosition = m_parentAnchorPosition;
m_this_ab.parentAnchorRotation = Quaternion.Euler(m_parentAnchorRotation);
}
}
void turnWheelEffect()
{
if (transform.parent == m_newParent)
{
float newState = m_this_ab.jointPosition[0];
if (Mathf.Abs(newState - m_state) > .3 && !m_turnWheelEffect.isPlaying)
{
if (!m_turnWheelEffect.isPlaying)
m_turnWheelEffect.Play();
}
else if (Mathf.Abs(newState - m_state) < .3 && m_turnWheelEffect.isPlaying)
{
m_turnWheelEffect.Stop();
}
m_state = newState;
}
}
void dissembleArticluationBody()
{
foreach (VG_HandStatus hand in VG_Controller.GetHands())
{
if (hand.m_selectedObject == transform && hand.IsHolding() && transform.parent == m_newParent)
{
VG_Controller.GetSensorPose(hand.m_avatarID, hand.m_side, out Vector3 sensor_pos, out Quaternion sensor_rot);
if ((sensor_pos - hand.m_hand.position).magnitude > m_disassembleDistance)
{
m_desiredPose.gameObject.SetActive(true);
transform.SetParent(m_newParent.parent);
timeAtDisassemble = Time.realtimeSinceStartup;
}
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 054b77b53fdbef942b8294187e768604
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,40 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
/**
* ChangeSelectionWeight shows as a tutorial on how to runtime change object
* selection weight to affect how easy an object can be selected for interaction with VG.
*/
[LIBVIRTUALGRASP_UNITY_SCRIPT]
[HelpURL("https://docs.virtualgrasp.com/unity_vgonboarding_task3." + VG_Version.__VG_VERSION__ + ".html")]
public class ChangeSelectionWeight : MonoBehaviour
{
public Transform m_dependent_object;
public float m_releasedWeight = 1.0f;
public float m_graspedWeight = 2.0f;
void Start()
{
VG_Controller.OnObjectFullyReleased.AddListener(ObjectReleased);
VG_Controller.OnObjectGrasped.AddListener(ObjectGrasped);
if (m_dependent_object == null)
m_dependent_object = transform.parent;
}
void ObjectReleased(VG_HandStatus hand)
{
if (hand.m_selectedObject == m_dependent_object)
VG_Controller.SetObjectSelectionWeight(transform, m_releasedWeight);
}
void ObjectGrasped(VG_HandStatus handStatus)
{
if (handStatus.m_selectedObject == m_dependent_object)
VG_Controller.SetObjectSelectionWeight(transform, m_graspedWeight);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1e5d7bc16b830194aaab42af13c5edeb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,117 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using System.Collections.Generic;
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
/**
* ManageContainerObject shows as a tutorial on how to use the VG_Controller.OnObjectFullyReleased
* and VG_Controller.OnObjectGrasped combined with Unity's physical joints to manage a
* container object to hold the contained physical objects stably without falling off.
*/
[LIBVIRTUALGRASP_UNITY_SCRIPT]
[HelpURL("https://docs.virtualgrasp.com/unity_vgonboarding_task3." + VG_Version.__VG_VERSION__ + ".html")]
public class ManageContainerObject : MonoBehaviour
{
/// A set off objects that are actively colliding with this one.
private HashSet<Transform> m_collisions = new HashSet<Transform>();
/// A map of objects with ArticulationBody to their original parents.
private Dictionary<Transform, Transform> m_parentCache = new Dictionary<Transform, Transform>();
/// A map of objects with Rigidbody to the fixed joints connecting to this container object
private Dictionary<Transform, FixedJoint> m_attachJoints = new Dictionary<Transform, FixedJoint>();
/// If dot product between velocity and down is large enough (ie. vectors are aligned).
public float m_dropAlignment = 0.8f;
private void Start()
{
// Register the some grasp event listeners
VG_Controller.OnObjectFullyReleased.AddListener(OnObjectFullyReleased);
VG_Controller.OnObjectGrasped.AddListener(OnObjectGrasped);
}
private void OnCollisionEnter(Collision collision)
{
// See if the object in collision is actually held by a hand (and is not a hand itself).
bool valid_object = true;
foreach (VG_HandStatus hand in VG_Controller.GetHands())
{
if (hand.m_hand == collision.transform)
valid_object &= false;
if (hand.m_selectedObject == collision.transform && hand.IsHolding())
valid_object &= false;
}
if (valid_object && // If it's valid ...
(collision.rigidbody != null || collision.gameObject.TryGetComponent(out ArticulationBody ab)) && // and has a rigid body or articulation body ...
Vector3.Dot(collision.relativeVelocity.normalized, Vector3.down) > m_dropAlignment) // .. and if the object is dropped from somewhat above.
{
Attach(collision.transform);
m_collisions.Add(collision.transform);
}
}
private void OnCollisionExit(Collision collision)
{
m_collisions.Remove(collision.transform);
}
private void OnObjectFullyReleased(VG_HandStatus hand)
{
if (m_collisions.Contains(hand.m_selectedObject))
Attach(hand.m_selectedObject);
}
private void OnObjectGrasped(VG_HandStatus hand)
{
Unattach(hand.m_selectedObject);
}
void Attach(Transform attachedObject)
{
if (attachedObject.gameObject.TryGetComponent<Rigidbody>(out Rigidbody rb))
{
if (!attachedObject.gameObject.TryGetComponent<FixedJoint>(out FixedJoint joint))
{
joint = attachedObject.gameObject.AddComponent<FixedJoint>();
m_attachJoints[attachedObject] = joint;
if (transform.gameObject.TryGetComponent<Rigidbody>(out Rigidbody container_rb))
joint.connectedBody = container_rb;
else if (transform.gameObject.TryGetComponent<ArticulationBody>(out ArticulationBody container_ab))
joint.connectedArticulationBody = container_ab;
}
}
else if (attachedObject.gameObject.TryGetComponent<ArticulationBody>(out ArticulationBody ab))
{
if (transform.gameObject.TryGetComponent<ArticulationBody>(out ArticulationBody container_ab))
{
m_parentCache[attachedObject] = attachedObject.parent;
attachedObject.SetParent(transform);
ab.jointType = ArticulationJointType.FixedJoint;
}
else
Debug.LogError("Can not attach object " + attachedObject.name + " with ArticulationBody to " + transform.name + " without ArticulationBody.");
}
}
void Unattach(Transform attachedObject)
{
if (attachedObject.gameObject.TryGetComponent<Rigidbody>(out Rigidbody rb))
{
if (!m_attachJoints.ContainsKey(attachedObject))
return;
DestroyImmediate(m_attachJoints[attachedObject]);
m_attachJoints.Remove(attachedObject);
}
else if (attachedObject.gameObject.TryGetComponent<ArticulationBody>(out ArticulationBody ab))
{
if (!transform.gameObject.TryGetComponent<ArticulationBody>(out ArticulationBody container_ab))
return;
if (attachedObject.parent != transform)
return;
attachedObject.SetParent(m_parentCache[attachedObject]);
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3be6ca0d1ceffe345aaa9e3ff210d457
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,34 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
public class MetalImpact : MonoBehaviour
{
public AudioSource plateCollisionEffect;
public AudioSource tableCollisionEffect;
private float verticalVelocityThreshold = 1.0F;
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.name.Contains("plate"))
{
if (collision.relativeVelocity.magnitude > verticalVelocityThreshold)
{
plateCollisionEffect.Play();
}
}
else if (collision.gameObject.name.Contains("SM_Factory1001"))
{
if (collision.relativeVelocity.magnitude > verticalVelocityThreshold)
{
tableCollisionEffect.Play();
}
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c2ac4b8eba29c04d82c7ae020855acf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,50 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
public class SimpleImpact : MonoBehaviour
{
public AudioSource collisionEffect;
private float unityVelocityThreshold = 1.0F;
private float calculatedVelocityThreshold = .1F;
ArticulationBody ownAB = null;
Rigidbody ownRB = null;
private void Start()
{
gameObject.TryGetComponent<Rigidbody>(out ownRB);
gameObject.TryGetComponent<ArticulationBody>(out ownAB);
}
private void OnCollisionEnter(Collision collision)
{
if (collision.relativeVelocity.magnitude > 0) // sometimes we're lucky. unity calculates speed for us
{
if (collision.relativeVelocity.magnitude > unityVelocityThreshold)
collisionEffect.Play();
}
else if (
#if UNITY_2020_3_16_OR_NEWER
collision.body != null &&
#endif
(ownRB != null || ownAB != null))
{ // sometimes we're not lucky, have to calculate
Vector3 ownSpeed = ownRB != null ? ownRB.velocity : ownAB.velocity;
Vector3 colliderSpeed = Vector3.zero;
#if UNITY_2020_3_16_OR_NEWER
if (collision.rigidbody != null) colliderSpeed = collision.rigidbody.velocity;
else if (collision.articulationBody != null) colliderSpeed = collision.articulationBody.velocity;
#else
if (collision.rigidbody != null) colliderSpeed = collision.rigidbody.velocity;
#endif
if ((ownSpeed - colliderSpeed).magnitude > calculatedVelocityThreshold)
collisionEffect.Play();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: dc9049278d75959408dcbd09cc42b52a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
using VirtualGrasp;
namespace VirtualGrasp.Onboarding
{
public class SoundOnGraspEvents : MonoBehaviour
{
public AudioSource graspSoundEffect;
private int avatarID = 0;
private void Start()
{
VG_Controller.GetSensorControlledAvatarID(out avatarID);
VG_Controller.OnGraspTriggered.AddListener(PlayGraspSound);
}
public void PlayGraspSound(VG_HandStatus hand)
{
if (hand.m_avatarID == avatarID)
graspSoundEffect.Play();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e191a5e09bcbe8348ba6f873e04b6700
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,23 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
public class SoundOnPushEvents : MonoBehaviour
{
public AudioSource pushSoundEffect;
// Start is called before the first frame update
void Start()
{
VG_Controller.OnObjectPushed.AddListener(PlayPushSound);
}
public void PlayPushSound(VG_HandStatus hand)
{
if (hand.m_selectedObject != null && hand.m_selectedObject == transform)
pushSoundEffect.Play();
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: a70782f4d7beb104f834d7ef2b69eff8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
// Copyright (C) 2014-2024 Gleechi Technology AB. All rights reserved.
using UnityEngine;
namespace VirtualGrasp.Onboarding
{
/**
* ToggleLight shows as a tutorial on a non-physical two-stage button setup
* through VG_Articulation and how to use VG_Controller.GetObjectJointState to toggle light on and off.
*/
[LIBVIRTUALGRASP_UNITY_SCRIPT]
[HelpURL("https://docs.virtualgrasp.com/unity_vgonboarding_task1.html")]
public class ToggleLight : MonoBehaviour
{
public GameObject m_light = null;
public GameObject m_light2 = null;
private VG_Articulation m_articulation = null;
public AudioSource m_audioSourceOn;
public AudioSource m_audioSourceOff;
private float m_state;
private bool m_binState = false;
void Start()
{
if (TryGetComponent<VG_Articulation>(out m_articulation))
{
VG_Controller.GetObjectJointState(transform, out m_state);
EvaluateState(m_state);
}
}
void Update()
{
VG_Controller.GetObjectJointState(transform, out float newState);
if (newState != m_state)
EvaluateState(newState);
m_state = newState;
}
void EvaluateState(float state)
{
if (state == m_articulation.m_min && m_binState)
{
m_binState = false;
m_light.SetActive(false);
m_light2.SetActive(false);
m_audioSourceOff.Play();
}
else if (state == m_articulation.m_max && !m_binState)
{
m_binState = true;
m_light.SetActive(true);
m_light2.SetActive(true);
m_audioSourceOn.Play();
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: af95904b851117246b5165ae986b0252
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8beec0007b72b8e44b52d29e183add4a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,74 @@
Shader "Gleechi/Diffuse"
{
Properties
{
_MainTex("Texture", 2D) = "white" {}
[NOSCALEOFFSET] _diffuse("diffuse map", Cube) = "white" {}
}
SubShader
{
Tags { "RenderType" = "Opaque" }
LOD 100
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float2 uv : TEXCOORD0;
float3 normal : NORMAL;
float3 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float2 uv : TEXCOORD0;
float4 vertex : SV_POSITION;
float3 normal : NORMAL;
float3 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
sampler2D _MainTex;
float4 _MainTex_ST;
samplerCUBE _diffuse;
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
o.uv = TRANSFORM_TEX(v.uv, _MainTex);
o.normal = UnityObjectToWorldNormal(v.normal);
o.color = v.color;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 col = tex2D(_MainTex, i.uv) * fixed4(i.color,1);
fixed4 diffuseLight = texCUBElod(_diffuse, float4(i.normal, 1));
diffuseLight /= diffuseLight + 1;
return col * diffuseLight;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 8de65bf60aa6c4f4caacbc6b0880fc35
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,89 @@
Shader "Gleechi/Glass"
{
Properties
{
[NOSCALEOFFSET] _diffuse_HDR("diffuse map", Cube) = "white" {}
}
SubShader
{
Tags { "RenderType" = "Transparent" "Queue"= "Transparent"}
LOD 100
Pass
{
//Cull Off
ZWrite Off
Blend One One
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
struct appdata
{
float4 vertex : POSITION;
float3 normal : NORMAL;
float3 color : COLOR;
UNITY_VERTEX_INPUT_INSTANCE_ID
};
struct v2f
{
float4 vertex : SV_POSITION;
float3 normal : NORMAL;
float3 color : COLOR;
float alpha : TEXCOORD;
UNITY_VERTEX_INPUT_INSTANCE_ID
UNITY_VERTEX_OUTPUT_STEREO
};
samplerCUBE _diffuse_HDR;
v2f vert(appdata v)
{
v2f o;
UNITY_SETUP_INSTANCE_ID(v);
UNITY_TRANSFER_INSTANCE_ID(v, o);
UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(o);
o.vertex = UnityObjectToClipPos(v.vertex);
float3 viewDir = normalize(ObjSpaceViewDir(v.vertex));
float f = 1 - saturate(dot(normalize(v.normal), viewDir) / 100);
o.alpha = lerp(0, 1.34, pow(f, 177));
o.normal = UnityObjectToWorldNormal(v.normal);
float3 wsViewDir = WorldSpaceViewDir(float4 (v.vertex.xyz,1));
o.normal = reflect(-wsViewDir, o.normal);
o.color = v.color;
return o;
}
fixed4 frag(v2f i) : SV_Target
{
fixed4 col = fixed4(i.color,1);
fixed4 diffuseLight = texCUBElod(_diffuse_HDR, float4(i.normal, 1));
diffuseLight /= diffuseLight + 1;
col *= diffuseLight;
col.a = saturate(i.alpha);
//col = (i.alpha);
return col;
}
ENDCG
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 60ebb9c34c421e141b021f0d536df52c
ShaderImporter:
externalObjects: {}
defaultTextures: []
nonModifiableTextures: []
preprocessorOverride: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fc999d14eb70d1647ad78fef7955fb80
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

View File

@@ -0,0 +1,98 @@
fileFormatVersion: 2
guid: 7d791f3ea91d49d4598753fefee584a0
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
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: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

View File

@@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 1070563d294b8e34894babab8f433d44
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
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: Server
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: Android
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: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View File

@@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: d4cf51e14ee745c4fa60c6aea9314226
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 2
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 32
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
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: Server
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: Android
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: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant: