Browse Source

Added Teleportation around ring.

Also updated Ring Environment
develop
Joshua Reason 4 years ago
parent
commit
c25d3421d2
14 changed files with 5989 additions and 4 deletions
  1. BIN
      Assets/Scenes/Test Scenes/Static Ring.unity
  2. +6
    -2
      Assets/Scripts/Static Physics/RotationController.cs
  3. +8
    -0
      Assets/Scripts/VR.meta
  4. +63
    -0
      Assets/Scripts/VR/RingBezierPointer.cs
  5. +11
    -0
      Assets/Scripts/VR/RingBezierPointer.cs.meta
  6. +58
    -0
      Assets/Scripts/VR/RingTeleportation.cs
  7. +11
    -0
      Assets/Scripts/VR/RingTeleportation.cs.meta
  8. +77
    -0
      Assets/World Assets/Materials/White.mat
  9. +8
    -0
      Assets/World Assets/Materials/White.mat.meta
  10. BIN
      Assets/World Assets/Models/BetterRing.fbx
  11. +97
    -0
      Assets/World Assets/Models/BetterRing.fbx.meta
  12. +8
    -0
      Assets/World Assets/Prefabs.meta
  13. +5630
    -0
      Assets/World Assets/Prefabs/_VRManager.prefab
  14. +7
    -0
      Assets/World Assets/Prefabs/_VRManager.prefab.meta

BIN
Assets/Scenes/Test Scenes/Static Ring.unity (Stored with Git LFS) View File

size 124840

+ 6
- 2
Assets/Scripts/Static Physics/RotationController.cs View File

@ -13,10 +13,14 @@ public class RotationController : MonoBehaviour
[SerializeField]
private float m_RotationPeriod;
[SerializeField]
private Vector3 m_RotationAxis = Vector3.forward;
private void FixedUpdate()
public Vector3 getDownDirection(Vector3 objectPosition)
{
transform.Rotate(Vector3.forward, 360/m_RotationPeriod * Time.fixedDeltaTime, Space.World);
return Vector3.ProjectOnPlane((objectPosition - transform.position).normalized, m_RotationAxis);
}

+ 8
- 0
Assets/Scripts/VR.meta View File

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

+ 63
- 0
Assets/Scripts/VR/RingBezierPointer.cs View File

@ -0,0 +1,63 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VRTK;
public class RingBezierPointer : VRTK_BezierPointerRenderer
{
#region Read-Only Fields
/// <summary>
/// Direction from Centre of ship to CameraRig
/// </summary>
public Vector3 DownDirection => m_ring.getDownDirection(transform.position);
#endregion Read-Only Fields
#region Inspector Fields
[Header("Ring Settings")]
[SerializeField, Tooltip("Reference to the Ship which is being teleported on. If left empty will try and find one in scene")]
private RotationController m_ring;
#endregion Inspector Fields
protected override void OnEnable()
{
base.OnEnable();
if (m_ring == null)
m_ring = FindObjectOfType<RotationController>();
}
protected override Vector3 ProjectDownBeam(Vector3 jointPosition)
{
Vector3 downPosition = Vector3.zero;
Ray projectedBeamDownRaycast = new Ray(jointPosition, DownDirection);
RaycastHit collidedWith;
bool downRayHit = VRTK_CustomRaycast.Raycast(customRaycast, projectedBeamDownRaycast, out collidedWith, defaultIgnoreLayer, maximumLength.y);
if (!downRayHit || (destinationHit.collider && destinationHit.collider != collidedWith.collider))
{
if (destinationHit.collider != null)
{
PointerExit(destinationHit);
}
destinationHit = new RaycastHit();
downPosition = projectedBeamDownRaycast.GetPoint(0f);
}
if (downRayHit)
{
downPosition = projectedBeamDownRaycast.GetPoint(collidedWith.distance);
PointerEnter(collidedWith);
destinationHit = collidedWith;
}
return downPosition;
}
}

+ 11
- 0
Assets/Scripts/VR/RingBezierPointer.cs.meta View File

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

+ 58
- 0
Assets/Scripts/VR/RingTeleportation.cs View File

@ -0,0 +1,58 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VRTK;
public class RingTeleportation : VRTK_HeightAdjustTeleport
{
#region Read-Only Fields
/// <summary>
/// Direction from Centre of ship to CameraRig
/// </summary>
public Vector3 DownDirection => m_ring.getDownDirection(playArea.position);
#endregion Read-Only Fields
#region Inspector Fields
[Header("Ring Settings")]
[SerializeField, Tooltip("Reference to the Ship which is being teleported on. If left empty will try and find one in scene")]
private RotationController m_ring;
#endregion Inspector Fields
protected override void OnEnable()
{
base.OnEnable();
if (m_ring == null)
m_ring = FindObjectOfType<RotationController>();
}
protected override Vector3 GetNewPosition(Vector3 tipPosition, Transform target, bool returnOriginalPosition)
{
Vector3 basePosition = base.GetNewPosition(tipPosition, target, true);
return basePosition;
}
protected override Quaternion SetNewRotation(Quaternion? rotation)
{
Debug.Log("Setting new rotation");
return Quaternion.FromToRotation(Vector3.down, DownDirection);
}
protected override void ProcessOrientation(object sender, DestinationMarkerEventArgs e, Vector3 targetPosition, Quaternion targetRotation)
{
base.ProcessOrientation(sender, e, targetPosition, targetRotation);
Quaternion newRotation = Quaternion.FromToRotation(Vector3.down, m_ring.getDownDirection(targetPosition));
playArea.rotation = newRotation;
}
}

+ 11
- 0
Assets/Scripts/VR/RingTeleportation.cs.meta View File

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

+ 77
- 0
Assets/World Assets/Materials/White.mat View File

@ -0,0 +1,77 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: White
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 6
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: 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}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.281
- _GlossyReflections: 1
- _Metallic: 0.207
- _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}

+ 8
- 0
Assets/World Assets/Materials/White.mat.meta View File

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

BIN
Assets/World Assets/Models/BetterRing.fbx (Stored with Git LFS) View File

size 278780

+ 97
- 0
Assets/World Assets/Models/BetterRing.fbx.meta View File

@ -0,0 +1,97 @@
fileFormatVersion: 2
guid: b94c538735c7e1d42abc86910cdb58db
ModelImporter:
serializedVersion: 19301
internalIDToNameTable: []
externalObjects: {}
materials:
materialImportMode: 1
materialName: 0
materialSearch: 1
materialLocation: 1
animations:
legacyGenerateAnimations: 4
bakeSimulation: 0
resampleCurves: 1
optimizeGameObjects: 0
motionNodeName:
rigImportErrors:
rigImportWarnings:
animationImportErrors:
animationImportWarnings:
animationRetargetingWarnings:
animationDoRetargetingWarnings: 0
importAnimatedCustomProperties: 0
importConstraints: 0
animationCompression: 1
animationRotationError: 0.5
animationPositionError: 0.5
animationScaleError: 0.5
animationWrapMode: 0
extraExposedTransformPaths: []
extraUserProperties: []
clipAnimations: []
isReadable: 0
meshes:
lODScreenPercentages: []
globalScale: 1
meshCompression: 0
addColliders: 0
useSRGBMaterialColor: 1
sortHierarchyByName: 1
importVisibility: 1
importBlendShapes: 1
importCameras: 1
importLights: 1
fileIdsGeneration: 2
swapUVChannels: 0
generateSecondaryUV: 0
useFileUnits: 1
keepQuads: 0
weldVertices: 1
preserveHierarchy: 0
skinWeightsMode: 0
maxBonesPerVertex: 4
minBoneWeight: 0.001
meshOptimizationFlags: -1
indexFormat: 0
secondaryUVAngleDistortion: 8
secondaryUVAreaDistortion: 15.000001
secondaryUVHardAngle: 88
secondaryUVPackMargin: 4
useFileScale: 1
tangentSpace:
normalSmoothAngle: 60
normalImportMode: 0
tangentImportMode: 3
normalCalculationMode: 4
legacyComputeAllNormalsFromSmoothingGroupsWhenMeshHasBlendShapes: 0
blendShapeNormalImportMode: 1
normalSmoothingSource: 0
referencedClips: []
importAnimation: 1
humanDescription:
serializedVersion: 3
human: []
skeleton: []
armTwist: 0.5
foreArmTwist: 0.5
upperLegTwist: 0.5
legTwist: 0.5
armStretch: 0.05
legStretch: 0.05
feetSpacing: 0
globalScale: 1
rootMotionBoneName:
hasTranslationDoF: 0
hasExtraRoot: 0
skeletonHasParents: 1
lastHumanDescriptionAvatarSource: {instanceID: 0}
autoGenerateAvatarMappingIfUnspecified: 1
animationType: 2
humanoidOversampling: 1
avatarSetup: 0
additionalBone: 0
userData:
assetBundleName:
assetBundleVariant:

+ 8
- 0
Assets/World Assets/Prefabs.meta View File

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

+ 5630
- 0
Assets/World Assets/Prefabs/_VRManager.prefab
File diff suppressed because it is too large
View File


+ 7
- 0
Assets/World Assets/Prefabs/_VRManager.prefab.meta View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: ce917c1fc9c926d4582545921991b2a5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Loading…
Cancel
Save