Fix many small bugs re: vr

This commit is contained in:
Jens Pitkänen 2020-05-02 19:28:42 +03:00
parent 93cabd0435
commit acc9f59a30
7 changed files with 88 additions and 44 deletions

View File

@ -74,6 +74,16 @@ PrefabInstance:
value: value:
objectReference: {fileID: 7463360716497058313, guid: 110da3f1de00910458a9e4ffd3585f94, objectReference: {fileID: 7463360716497058313, guid: 110da3f1de00910458a9e4ffd3585f94,
type: 3} type: 3}
- target: {fileID: 5825517555167498412, guid: 083f2630e3468274594f4435b3e82c1d,
type: 3}
propertyPath: StickSpawnAngle
value: 100
objectReference: {fileID: 0}
- target: {fileID: 5825517555167498412, guid: 083f2630e3468274594f4435b3e82c1d,
type: 3}
propertyPath: StickSpawnMinDistanceBehind
value: 5
objectReference: {fileID: 0}
- target: {fileID: 8593229712972662916, guid: 083f2630e3468274594f4435b3e82c1d, - target: {fileID: 8593229712972662916, guid: 083f2630e3468274594f4435b3e82c1d,
type: 3} type: 3}
propertyPath: m_Name propertyPath: m_Name

View File

@ -58,11 +58,11 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 443632513096267316} m_GameObject: {fileID: 443632513096267316}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.011, y: 0.248, z: -0.008} m_LocalPosition: {x: 0.010999999, y: 0.24799998, z: -0.007999986}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 2899778610982221264} m_Father: {fileID: 2610615721835511218}
m_RootOrder: 3 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &8748250233633719603 --- !u!108 &8748250233633719603
Light: Light:
@ -113,7 +113,7 @@ Light:
m_RenderMode: 0 m_RenderMode: 0
m_CullingMask: m_CullingMask:
serializedVersion: 2 serializedVersion: 2
m_Bits: 4294967295 m_Bits: 261943
m_RenderingLayerMask: 1 m_RenderingLayerMask: 1
m_Lightmapping: 4 m_Lightmapping: 4
m_LightShadowCasterMode: 0 m_LightShadowCasterMode: 0
@ -154,7 +154,7 @@ Transform:
m_LocalPosition: {x: 0.0074999984, y: 0.21449998, z: -0.0038999766} m_LocalPosition: {x: 0.0074999984, y: 0.21449998, z: -0.0038999766}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 2899778610982221264} m_Father: {fileID: 2610615721835511218}
m_RootOrder: 0 m_RootOrder: 0
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0} m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!198 &3254426058832931568 --- !u!198 &3254426058832931568
@ -5115,9 +5115,11 @@ MonoBehaviour:
IgnitedQuality: {fileID: 11400000, guid: 62d0193d1d08b814d9328f3dd1d117cb, type: 2} IgnitedQuality: {fileID: 11400000, guid: 62d0193d1d08b814d9328f3dd1d117cb, type: 2}
IgniteDuration: 1 IgniteDuration: 1
Ignited: 0 Ignited: 0
Extinguished: 0
TorchDuration: 60 TorchDuration: 60
TorchWarnDuration: 15 TorchWarnDuration: 15
StickObject: {fileID: 8047787840955207861} StickObject: {fileID: 8047787840955207861}
DestroyedOnExtinguish: {fileID: 8983857824270516560}
TorchObject: {fileID: 2973616090333718160} TorchObject: {fileID: 2973616090333718160}
FireParticles: {fileID: 3254426058832931568} FireParticles: {fileID: 3254426058832931568}
TorchLight: {fileID: 8748250233633719603} TorchLight: {fileID: 8748250233633719603}
@ -5198,11 +5200,8 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 5462489599864937972}
- {fileID: 492264085053241644} - {fileID: 492264085053241644}
- {fileID: 5403364364719854795} - {fileID: 2610615721835511218}
- {fileID: 8021664233870439167}
- {fileID: 3231062120356253589}
m_Father: {fileID: 4537129283620474398} m_Father: {fileID: 4537129283620474398}
m_RootOrder: 2 m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -5231,11 +5230,11 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5167658256675356045} m_GameObject: {fileID: 5167658256675356045}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.011, y: 0.22799997, z: 0} m_LocalPosition: {x: 0.011000001, y: 0.22799996, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 2899778610982221264} m_Father: {fileID: 2610615721835511218}
m_RootOrder: 4 m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!82 &6154545472424041098 --- !u!82 &6154545472424041098
AudioSource: AudioSource:
@ -5359,11 +5358,11 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7969813197317806167} m_GameObject: {fileID: 7969813197317806167}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.012, y: 0.265, z: -0.015} m_LocalPosition: {x: 0.012, y: 0.265, z: -0.014999986}
m_LocalScale: {x: 0.13, y: 0.13, z: 0.13} m_LocalScale: {x: 0.13, y: 0.12999998, z: 0.13}
m_Children: [] m_Children: []
m_Father: {fileID: 2899778610982221264} m_Father: {fileID: 2610615721835511218}
m_RootOrder: 2 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &287708470093378576 --- !u!65 &287708470093378576
BoxCollider: BoxCollider:
@ -5453,6 +5452,40 @@ BoxCollider:
serializedVersion: 2 serializedVersion: 2
m_Size: {x: 0.05, y: 0.48, z: 0.06} m_Size: {x: 0.05, y: 0.48, z: 0.06}
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &8983857824270516560
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2610615721835511218}
m_Layer: 10
m_Name: Destroyed on Extinguish
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2610615721835511218
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8983857824270516560}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 5462489599864937972}
- {fileID: 5403364364719854795}
- {fileID: 8021664233870439167}
- {fileID: 3231062120356253589}
m_Father: {fileID: 2899778610982221264}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &4876953494820377142 --- !u!1001 &4876953494820377142
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -5498,7 +5531,7 @@ PrefabInstance:
- target: {fileID: -4216859302048453862, guid: e44ff149e18c4334b82caa71b1fae7f7, - target: {fileID: -4216859302048453862, guid: e44ff149e18c4334b82caa71b1fae7f7,
type: 3} type: 3}
propertyPath: m_RootOrder propertyPath: m_RootOrder
value: 1 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: -4216859302048453862, guid: e44ff149e18c4334b82caa71b1fae7f7, - target: {fileID: -4216859302048453862, guid: e44ff149e18c4334b82caa71b1fae7f7,
type: 3} type: 3}

View File

@ -728,7 +728,7 @@ GameObject:
- component: {fileID: 71220341} - component: {fileID: 71220341}
- component: {fileID: 71220343} - component: {fileID: 71220343}
- component: {fileID: 71220342} - component: {fileID: 71220342}
m_Layer: 0 m_Layer: 18
m_Name: Shadow fixeroo (1) m_Name: Shadow fixeroo (1)
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -9376,11 +9376,11 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 831661729} m_GameObject: {fileID: 831661729}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} 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.05}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 2110606700} m_Father: {fileID: 1583384491}
m_RootOrder: 0 m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &831877394 stripped --- !u!4 &831877394 stripped
Transform: Transform:
@ -10178,11 +10178,7 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11445746, guid: 7a135b1a2cb9c8f488d4dd00c55ab283, type: 3} - target: {fileID: 11445746, guid: 7a135b1a2cb9c8f488d4dd00c55ab283, type: 3}
propertyPath: traceLayerMask.m_Bits propertyPath: traceLayerMask.m_Bits
value: 69633 value: 69632
objectReference: {fileID: 0}
- target: {fileID: 11445746, guid: 7a135b1a2cb9c8f488d4dd00c55ab283, type: 3}
propertyPath: floorFixupTraceLayerMask.m_Bits
value: 32768
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 11445746, guid: 7a135b1a2cb9c8f488d4dd00c55ab283, type: 3} - target: {fileID: 11445746, guid: 7a135b1a2cb9c8f488d4dd00c55ab283, type: 3}
propertyPath: arcDistance propertyPath: arcDistance
@ -11305,7 +11301,7 @@ Transform:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 958093120} m_GameObject: {fileID: 958093120}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -250, y: -7.9, z: -250} m_LocalPosition: {x: -250, y: -7.99, z: -250}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 1660514110} m_Father: {fileID: 1660514110}
@ -11343,7 +11339,7 @@ Terrain:
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 958093120} m_GameObject: {fileID: 958093120}
m_Enabled: 1 m_Enabled: 0
serializedVersion: 6 serializedVersion: 6
m_TerrainData: {fileID: 15600000, guid: 85dedbb94d734264c82f96e027273354, type: 2} m_TerrainData: {fileID: 15600000, guid: 85dedbb94d734264c82f96e027273354, type: 2}
m_TreeDistance: 5000 m_TreeDistance: 5000
@ -16158,7 +16154,7 @@ GameObject:
- component: {fileID: 1445458448} - component: {fileID: 1445458448}
- component: {fileID: 1445458450} - component: {fileID: 1445458450}
- component: {fileID: 1445458449} - component: {fileID: 1445458449}
m_Layer: 0 m_Layer: 18
m_Name: Shadow fixeroo m_Name: Shadow fixeroo
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
@ -18707,6 +18703,12 @@ Transform:
type: 3} type: 3}
m_PrefabInstance: {fileID: 1034908970} m_PrefabInstance: {fileID: 1034908970}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!4 &1583384491 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 471722, guid: dc06161b6d97feb419f45f03b62e14b9,
type: 3}
m_PrefabInstance: {fileID: 189615142}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1585922906 stripped --- !u!1 &1585922906 stripped
GameObject: GameObject:
m_CorrespondingSourceObject: {fileID: 6125707628839966531, guid: 558201eae20fa5540a826edb23937665, m_CorrespondingSourceObject: {fileID: 6125707628839966531, guid: 558201eae20fa5540a826edb23937665,
@ -24957,12 +24959,6 @@ PrefabInstance:
objectReference: {fileID: 0} objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 65b9ab5277d05de459f2091021e0ee01, type: 3} m_SourcePrefab: {fileID: 100100000, guid: 65b9ab5277d05de459f2091021e0ee01, type: 3}
--- !u!4 &2110606700 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 453574, guid: dc06161b6d97feb419f45f03b62e14b9,
type: 3}
m_PrefabInstance: {fileID: 189615142}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2115104243 --- !u!1 &2115104243
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@ -10,11 +10,13 @@ public class ItemVR : MonoBehaviour {
public BurnQuality IgnitedQuality; public BurnQuality IgnitedQuality;
public float IgniteDuration; public float IgniteDuration;
public bool Ignited = false; public bool Ignited = false;
public bool Extinguished = false;
public float TorchDuration; public float TorchDuration;
public float TorchWarnDuration; public float TorchWarnDuration;
[Header("Burning indicators")] [Header("Burning indicators")]
public GameObject StickObject; public GameObject StickObject;
public GameObject DestroyedOnExtinguish;
public GameObject TorchObject; public GameObject TorchObject;
public ParticleSystem FireParticles; public ParticleSystem FireParticles;
public Light TorchLight; public Light TorchLight;
@ -31,19 +33,17 @@ public class ItemVR : MonoBehaviour {
private float IgnitionStartTime = -1; private float IgnitionStartTime = -1;
private Color NormalColor; private Color NormalColor;
private Vector3 LastPosition;
private void Start() { private void Start() {
Burnable = GetComponent<Burnable>(); Burnable = GetComponent<Burnable>();
NormalColor = TorchLight.color; NormalColor = TorchLight.color;
TorchObject.SetActive(Ignited); TorchObject.SetActive(Ignited);
StickObject.SetActive(!Ignited); StickObject.SetActive(!Ignited);
LastPosition = transform.position;
} }
private void Update() { private void Update() {
Vector3 Velocity = transform.position - LastPosition; if (Extinguished) {
LastPosition = transform.position; return;
}
if (Ignited && TorchLight.enabled) { if (Ignited && TorchLight.enabled) {
TorchFuel -= Time.deltaTime; TorchFuel -= Time.deltaTime;
@ -66,7 +66,8 @@ public class ItemVR : MonoBehaviour {
FireVolume.layer = gameObject.layer; FireVolume.layer = gameObject.layer;
TorchLight.range = Mathf.Lerp(TorchLight.range, 0, 10f * Time.deltaTime); TorchLight.range = Mathf.Lerp(TorchLight.range, 0, 10f * Time.deltaTime);
if (TorchLight.range < 0.01f) { if (TorchLight.range < 0.01f) {
TorchLight.enabled = false; Destroy(DestroyedOnExtinguish);
Extinguished = true;
} }
} }
} else if (!Ignited && !Burnable.BurningInCampfire && IgnitionStartTime != -1 && Time.time - IgnitionStartTime >= IgniteDuration) { } else if (!Ignited && !Burnable.BurningInCampfire && IgnitionStartTime != -1 && Time.time - IgnitionStartTime >= IgniteDuration) {

View File

@ -9,6 +9,8 @@ public class StickSpawner : MonoBehaviour {
public float StickSpawnChance = 0.5f; public float StickSpawnChance = 0.5f;
public float StickSpawnMinDistance = 5f; public float StickSpawnMinDistance = 5f;
[Tooltip("Stick spawning minimum distance when spawning a stick behind the player. These can be noticeable in VR because of erratic head movements.")]
public float StickSpawnMinDistanceBehind = 0f;
public float StickSpawnAngle = 70f; public float StickSpawnAngle = 70f;
public float StickSpawnTimer = 2f; public float StickSpawnTimer = 2f;
@ -21,7 +23,7 @@ public class StickSpawner : MonoBehaviour {
private PickupStatus SpawnedPickup; private PickupStatus SpawnedPickup;
void Awake() { void Awake() {
Player = GameObject.FindGameObjectWithTag("Player"); Player = GameObject.FindGameObjectWithTag("MainCamera");
LastSpawn = Time.time + StickSpawnTimer * Random.value; LastSpawn = Time.time + StickSpawnTimer * Random.value;
} }
@ -41,7 +43,8 @@ public class StickSpawner : MonoBehaviour {
} }
var dir = transform.position - Player.transform.position; var dir = transform.position - Player.transform.position;
if ((Vector3.Angle(Player.transform.forward, dir) > StickSpawnAngle) || dir.magnitude > StickSpawnMinDistance && Random.value <= StickSpawnChance) { if ((Vector3.Angle(Player.transform.forward, dir) > StickSpawnAngle && dir.magnitude > StickSpawnMinDistanceBehind) ||
dir.magnitude > StickSpawnMinDistance && Random.value <= StickSpawnChance) {
var SpawnedThing = StickPrefab; var SpawnedThing = StickPrefab;
if (Random.value <= CasetteChance) { if (Random.value <= CasetteChance) {
SpawnedThing = CasettePrefab; SpawnedThing = CasettePrefab;

View File

@ -1,5 +1,6 @@
Shader "Unlit/TeleportTerrain" Shader "Unlit/TeleportTerrain"
{ {
// Note: this shader isn't actually used in the game currently.
Properties Properties
{ {
_Color ("Color", Color) = (1, 1, 1, 1) _Color ("Color", Color) = (1, 1, 1, 1)

View File

@ -27,7 +27,7 @@ TagManager:
- Ground - Ground
- Teleport - Teleport
- Fire - Fire
- - Shadow Faking Objects
- -
- -
- -