Initialer Upload neues Unity-Projekt
This commit is contained in:
9
Assets/SteamVR/InteractionSystem/SnapTurn/Materials.meta
Normal file
9
Assets/SteamVR/InteractionSystem/SnapTurn/Materials.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f833381992f014a4bb240bec0f0748f0
|
||||
folderAsset: yes
|
||||
timeCreated: 1568160751
|
||||
licenseType: Store
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -0,0 +1,138 @@
|
||||
%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: snapTurnArrow
|
||||
m_Shader: {fileID: 4800000, guid: 933532a4fcc9baf4fa0491de14d08ed7, type: 3}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _EMISSION
|
||||
- _SURFACE_TYPE_TRANSPARENT
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses:
|
||||
- DepthOnly
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BaseMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _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: 0}
|
||||
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}
|
||||
- _SpecGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_Lightmaps:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_LightmapsInd:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- unity_ShadowMasks:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _AlphaClip: 0
|
||||
- _AlphaToMask: 0
|
||||
- _Blend: 1
|
||||
- _BlendModePreserveSpecular: 1
|
||||
- _BumpScale: 1
|
||||
- _ClearCoatMask: 0
|
||||
- _ClearCoatSmoothness: 0
|
||||
- _Cull: 2
|
||||
- _Cutoff: 0.5
|
||||
- _DetailAlbedoMapScale: 1
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _DstBlendAlpha: 10
|
||||
- _EnvironmentReflections: 1
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 3
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _QueueOffset: 0
|
||||
- _ReceiveShadows: 1
|
||||
- _Smoothness: 0.5
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _SrcBlendAlpha: 1
|
||||
- _Surface: 1
|
||||
- _UVSec: 0
|
||||
- _WorkflowMode: 1
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _BaseColor: {r: 0.8, g: 0.8, b: 0.8, a: 0.19999999}
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
--- !u!114 &258238116186908458
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 11
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
version: 7
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0bbd832b13230de459422d3264b929c7
|
||||
timeCreated: 1568160751
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
183
Assets/SteamVR/InteractionSystem/SnapTurn/SnapTurn.cs
Normal file
183
Assets/SteamVR/InteractionSystem/SnapTurn/SnapTurn.cs
Normal file
@ -0,0 +1,183 @@
|
||||
// Copyright (c) Valve Corporation, All rights reserved. ======================================================================================================
|
||||
|
||||
|
||||
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
namespace Valve.VR.InteractionSystem
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
public class SnapTurn : MonoBehaviour
|
||||
{
|
||||
public float snapAngle = 90.0f;
|
||||
|
||||
public bool showTurnAnimation = true;
|
||||
|
||||
public AudioSource snapTurnSource;
|
||||
public AudioClip rotateSound;
|
||||
|
||||
public GameObject rotateRightFX;
|
||||
public GameObject rotateLeftFX;
|
||||
|
||||
public SteamVR_Action_Boolean snapLeftAction = SteamVR_Input.GetBooleanAction("SnapTurnLeft");
|
||||
public SteamVR_Action_Boolean snapRightAction = SteamVR_Input.GetBooleanAction("SnapTurnRight");
|
||||
|
||||
public bool fadeScreen = true;
|
||||
public float fadeTime = 0.1f;
|
||||
public Color screenFadeColor = Color.black;
|
||||
|
||||
public float distanceFromFace = 1.3f;
|
||||
public Vector3 additionalOffset = new Vector3(0, -0.3f, 0);
|
||||
|
||||
public static float teleportLastActiveTime;
|
||||
|
||||
private bool canRotate = true;
|
||||
|
||||
public float canTurnEverySeconds = 0.4f;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
AllOff();
|
||||
}
|
||||
|
||||
private void AllOff()
|
||||
{
|
||||
if (rotateLeftFX != null)
|
||||
rotateLeftFX.SetActive(false);
|
||||
|
||||
if (rotateRightFX != null)
|
||||
rotateRightFX.SetActive(false);
|
||||
}
|
||||
|
||||
|
||||
private void Update()
|
||||
{
|
||||
Player player = Player.instance;
|
||||
|
||||
if (canRotate && snapLeftAction != null && snapRightAction != null && snapLeftAction.activeBinding && snapRightAction.activeBinding)
|
||||
{
|
||||
//only allow snap turning after a quarter second after the last teleport
|
||||
if (Time.time < (teleportLastActiveTime + canTurnEverySeconds))
|
||||
return;
|
||||
|
||||
// only allow snap turning when not holding something
|
||||
|
||||
bool rightHandValid = player.rightHand.currentAttachedObject == null ||
|
||||
(player.rightHand.currentAttachedObject != null
|
||||
&& player.rightHand.currentAttachedTeleportManager != null
|
||||
&& player.rightHand.currentAttachedTeleportManager.teleportAllowed);
|
||||
|
||||
bool leftHandValid = player.leftHand.currentAttachedObject == null ||
|
||||
(player.leftHand.currentAttachedObject != null
|
||||
&& player.leftHand.currentAttachedTeleportManager != null
|
||||
&& player.leftHand.currentAttachedTeleportManager.teleportAllowed);
|
||||
|
||||
|
||||
bool leftHandTurnLeft = snapLeftAction.GetStateDown(SteamVR_Input_Sources.LeftHand) && leftHandValid;
|
||||
bool rightHandTurnLeft = snapLeftAction.GetStateDown(SteamVR_Input_Sources.RightHand) && rightHandValid;
|
||||
|
||||
bool leftHandTurnRight = snapRightAction.GetStateDown(SteamVR_Input_Sources.LeftHand) && leftHandValid;
|
||||
bool rightHandTurnRight = snapRightAction.GetStateDown(SteamVR_Input_Sources.RightHand) && rightHandValid;
|
||||
|
||||
if (leftHandTurnLeft || rightHandTurnLeft)
|
||||
{
|
||||
RotatePlayer(-snapAngle);
|
||||
}
|
||||
else if (leftHandTurnRight || rightHandTurnRight)
|
||||
{
|
||||
RotatePlayer(snapAngle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Coroutine rotateCoroutine;
|
||||
public void RotatePlayer(float angle)
|
||||
{
|
||||
if (rotateCoroutine != null)
|
||||
{
|
||||
StopCoroutine(rotateCoroutine);
|
||||
AllOff();
|
||||
}
|
||||
|
||||
rotateCoroutine = StartCoroutine(DoRotatePlayer(angle));
|
||||
}
|
||||
|
||||
//-----------------------------------------------------
|
||||
private IEnumerator DoRotatePlayer(float angle)
|
||||
{
|
||||
Player player = Player.instance;
|
||||
|
||||
canRotate = false;
|
||||
|
||||
snapTurnSource.panStereo = angle / 90;
|
||||
snapTurnSource.PlayOneShot(rotateSound);
|
||||
|
||||
if (fadeScreen)
|
||||
{
|
||||
SteamVR_Fade.Start(Color.clear, 0);
|
||||
|
||||
Color tColor = screenFadeColor;
|
||||
tColor = tColor.linear * 0.6f;
|
||||
SteamVR_Fade.Start(tColor, fadeTime);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(fadeTime);
|
||||
|
||||
Vector3 playerFeetOffset = player.trackingOriginTransform.position - player.feetPositionGuess;
|
||||
player.trackingOriginTransform.position -= playerFeetOffset;
|
||||
player.transform.Rotate(Vector3.up, angle);
|
||||
playerFeetOffset = Quaternion.Euler(0.0f, angle, 0.0f) * playerFeetOffset;
|
||||
player.trackingOriginTransform.position += playerFeetOffset;
|
||||
|
||||
GameObject fx = angle > 0 ? rotateRightFX : rotateLeftFX;
|
||||
|
||||
if (showTurnAnimation)
|
||||
ShowRotateFX(fx);
|
||||
|
||||
if (fadeScreen)
|
||||
{
|
||||
SteamVR_Fade.Start(Color.clear, fadeTime);
|
||||
}
|
||||
|
||||
float startTime = Time.time;
|
||||
float endTime = startTime + canTurnEverySeconds;
|
||||
|
||||
while (Time.time <= endTime)
|
||||
{
|
||||
yield return null;
|
||||
UpdateOrientation(fx);
|
||||
};
|
||||
|
||||
fx.SetActive(false);
|
||||
canRotate = true;
|
||||
}
|
||||
|
||||
void ShowRotateFX(GameObject fx)
|
||||
{
|
||||
if (fx == null)
|
||||
return;
|
||||
|
||||
fx.SetActive(false);
|
||||
|
||||
UpdateOrientation(fx);
|
||||
|
||||
fx.SetActive(true);
|
||||
|
||||
UpdateOrientation(fx);
|
||||
}
|
||||
|
||||
private void UpdateOrientation(GameObject fx)
|
||||
{
|
||||
Player player = Player.instance;
|
||||
|
||||
//position fx in front of face
|
||||
this.transform.position = player.hmdTransform.position + (player.hmdTransform.forward * distanceFromFace);
|
||||
this.transform.rotation = Quaternion.LookRotation(player.hmdTransform.position - this.transform.position, Vector3.up);
|
||||
this.transform.Translate(additionalOffset, Space.Self);
|
||||
this.transform.rotation = Quaternion.LookRotation(player.hmdTransform.position - this.transform.position, Vector3.up);
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Assets/SteamVR/InteractionSystem/SnapTurn/SnapTurn.cs.meta
Normal file
12
Assets/SteamVR/InteractionSystem/SnapTurn/SnapTurn.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7434e43635fb2924583f5e0f2fb6ed3a
|
||||
timeCreated: 1568160739
|
||||
licenseType: Store
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
46
Assets/SteamVR/InteractionSystem/SnapTurn/snapTurnArrow.mat
Normal file
46
Assets/SteamVR/InteractionSystem/SnapTurn/snapTurnArrow.mat
Normal file
@ -0,0 +1,46 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: snapTurnArrow
|
||||
m_Shader: {fileID: 4800000, guid: 787d7485aa6482341a9f55fa37fb84f1, type: 3}
|
||||
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
|
||||
m_LightmapFlags: 4
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second: 0
|
||||
- first:
|
||||
name: _Darken
|
||||
second: 0.788
|
||||
- first:
|
||||
name: _SeeThru
|
||||
second: 0.819
|
||||
m_Colors:
|
||||
- first:
|
||||
name: <noninit>
|
||||
second: {r: 0, g: 2.0185626, b: 1e-45, a: -1.4179275e-16}
|
||||
- first:
|
||||
name: _TintColor
|
||||
second: {r: 0.2980392, g: 0.6784314, b: 1, a: 0.8235294}
|
||||
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1e683e8bf011f94ab3c2f6d097aa87c
|
||||
timeCreated: 1568160750
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/SnapTurn/snapTurnFX.fbx
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/SnapTurn/snapTurnFX.fbx
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,95 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 62dcc32f358950744a33cf3ced87eaed
|
||||
timeCreated: 1568160751
|
||||
licenseType: Store
|
||||
ModelImporter:
|
||||
serializedVersion: 19
|
||||
fileIDToRecycleName:
|
||||
100000: Armature
|
||||
100002: arrow
|
||||
100004: arrow 1
|
||||
100006: dot_0
|
||||
100008: dot_1
|
||||
100010: dot_2
|
||||
100012: dot_3
|
||||
100014: dot_4
|
||||
100016: dot_5
|
||||
100018: //RootNode
|
||||
400000: Armature
|
||||
400002: arrow
|
||||
400004: arrow 1
|
||||
400006: dot_0
|
||||
400008: dot_1
|
||||
400010: dot_2
|
||||
400012: dot_3
|
||||
400014: dot_4
|
||||
400016: dot_5
|
||||
400018: //RootNode
|
||||
4300000: arrow
|
||||
7400000: Armature|arrowAnim
|
||||
9500000: //RootNode
|
||||
13700000: arrow
|
||||
materials:
|
||||
importMaterials: 1
|
||||
materialName: 0
|
||||
materialSearch: 1
|
||||
animations:
|
||||
legacyGenerateAnimations: 4
|
||||
bakeSimulation: 0
|
||||
resampleCurves: 1
|
||||
optimizeGameObjects: 0
|
||||
motionNodeName:
|
||||
animationImportErrors:
|
||||
animationImportWarnings:
|
||||
animationRetargetingWarnings:
|
||||
animationDoRetargetingWarnings: 0
|
||||
animationCompression: 1
|
||||
animationRotationError: 0.5
|
||||
animationPositionError: 0.5
|
||||
animationScaleError: 0.5
|
||||
animationWrapMode: 0
|
||||
extraExposedTransformPaths: []
|
||||
clipAnimations: []
|
||||
isReadable: 1
|
||||
meshes:
|
||||
lODScreenPercentages: []
|
||||
globalScale: 10
|
||||
meshCompression: 0
|
||||
addColliders: 0
|
||||
importBlendShapes: 1
|
||||
swapUVChannels: 0
|
||||
generateSecondaryUV: 0
|
||||
useFileUnits: 1
|
||||
optimizeMeshForGPU: 1
|
||||
keepQuads: 0
|
||||
weldVertices: 1
|
||||
secondaryUVAngleDistortion: 8
|
||||
secondaryUVAreaDistortion: 15.000001
|
||||
secondaryUVHardAngle: 88
|
||||
secondaryUVPackMargin: 4
|
||||
useFileScale: 1
|
||||
tangentSpace:
|
||||
normalSmoothAngle: 60
|
||||
normalImportMode: 0
|
||||
tangentImportMode: 3
|
||||
importAnimation: 1
|
||||
copyAvatar: 0
|
||||
humanDescription:
|
||||
human: []
|
||||
skeleton: []
|
||||
armTwist: 0.5
|
||||
foreArmTwist: 0.5
|
||||
upperLegTwist: 0.5
|
||||
legTwist: 0.5
|
||||
armStretch: 0.05
|
||||
legStretch: 0.05
|
||||
feetSpacing: 0
|
||||
rootMotionBoneName:
|
||||
hasTranslationDoF: 0
|
||||
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||
animationType: 2
|
||||
humanoidOversampling: 1
|
||||
additionalBone: 0
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/SnapTurn/snapturnFX.controller
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/SnapTurn/snapturnFX.controller
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 24592bbd7bf3c5c489c70fba25d75ee0
|
||||
timeCreated: 1568160751
|
||||
licenseType: Store
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/SteamVR/InteractionSystem/SnapTurn/snapturn_go_01.wav
(Stored with Git LFS)
Normal file
BIN
Assets/SteamVR/InteractionSystem/SnapTurn/snapturn_go_01.wav
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 973c016de5a1cf34ebb6b3477ca2da5c
|
||||
timeCreated: 1568161563
|
||||
licenseType: Store
|
||||
AudioImporter:
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user