cancel
Showing results for 
Search instead for 
Did you mean: 

SkyIslands VR

erica_layton
Expert Protege
9qi24zif03en.png
Hello, from a world where islands float in the air, and an ancient guild of mages once lived, only to vanish. Clues about who they were and the ecological disaster they wrought can be found in the landscape. Your mission is to help restore balance, and set their ghosts to rest.

I'm actually a few months into the process of building the SkyIslands game. It's slow going, because I'm doing all parts of it myself:  game mechanics, 3D assets, coding, sound design--whatever is needed. I've also been doing various contract work on the side, but focussing as much time as I can afford to on this project, with the goal of publishing it for GearVR on the Oculus Store.

Participating in the Launchpad has given me the encouragement I needed to continue working towards my goals for this game!

So far, I've produced a demo. Here's a walkthrough, captured in GearVR. It's not very interesting yet: I'm currently re-writing the mythos for the world (Thanks to Bernie Yee for great advice!), out of which will flow stories, strung together with puzzles and games for the player.

VIDEO: https://www.youtube.com/watch?v=3ybZEH8c5I8

mv7104zsfr52.png

55 REPLIES 55

erica_layton
Expert Protege
If anyone has advice on adding tweening to the coroutine above, that would be greatly appreciated! Right now, the movement has no easing and has kinda jerky start/stop as a result. Been looking at the DOTween extension, because it supports a few kinds of easing..

Anonymous
Not applicable
There's a bunch of tweening libraries out there, but I end up just making things work myself.
As for your multiple wayponts but only being able to send one variable with Playmaker, can you make separate functions and call Walking() from each?
Waypoint1() { 
speed = 1f;
  StartCoroutine(Walking(5, speed));
}
Waypoint2() {
speed = 0.5f;
  StartCoroutine(Walking(2, speed));
}
or just keep it in the waypoints array with game objects with a script holding it's variable speed

speed = waypoints[num].GetComponent<ScriptInThisGameObject>().speed;





erica_layton
Expert Protege
omg, it's SUCH A CLUSTER with the way I have the movement set up... but it's working!

In order to move the character and play the correct animation for the speed the character is moving at, I have to call the coroutine for moving to the next waypoint, and also set the animator controller's Speed parameter, using a separate action within the same state (right before or after starting coroutine)

The coroutine's 'while' loop keeps it chugging along until the character gets within the minimum distance of the waypoint it's targeted. When character collides with rigidbody on the waypoint, it sends TRIGGER ENTER event, which allows FSM to proceed to next state..

There's gotta be a better way to do this, but I will figure that out later. For now, this will work.

scabu2in8ncx.png

Thanks again to @MissFacetious for the suggestions!!! 

I ended up putting a float for "speed when moving towards this destination" on each waypoint:
 using UnityEngine;
using System.Collections;

public class WayPoint : MonoBehaviour {

public float speed;

}

And then modified my coroutine to get this float from waypoint at index that was passed in at coroutine start:

using UnityEngine;
using System.Collections;

public class WaypointsCoroutine : MonoBehaviour {

public GameObject[] waypoints;
public int num;

public float minDist;

IEnumerator Walking(int num){
float speed = waypoints[num].GetComponent<WayPoint>().speed;

while (true) {
float dist = Vector3.Distance(gameObject.transform.position, waypoints[num].transform.position);
gameObject.transform.LookAt (waypoints [num].transform.position);
gameObject.transform.position += gameObject.transform.forward * speed * Time.deltaTime;

if (dist < minDist) {
yield break;
} else {
yield return 0;
}

}
}
}


erica_layton
Expert Protege
@cybereality Quick question: with the addition of an "Oculus Home" button on the outside of the new version of GearVR, is there a new Universal Menu handler script we need to use, that includes this button? 

erica_layton
Expert Protege
arteopzsxhad.pngMade a gaze-based teleport that subscribes to events from those VRStandardAssets that Unity had in their VR samples. Took me a lot of fiddling to get it to work, but now I've got gaze-activated teleports that give both visual and auditory feedback when you look at them.

Getting there...


using UnityEngine;
using System.Collections;
using VRStandardAssets.Utils;

/// <summary>
/// Gaze teleport. Thing by Erica Layton. Use carefully: probably still buggy!
/// </summary>

public class GazeTeleport : MonoBehaviour {

//things n stuff 
public GameObject player;
private Vector3 playerPos;
public Vector3 portpoint;
//audio stuff
public AudioClip audioClip;
public float volume = 1;
//stuff for VRInteractiveItem events
[SerializeField] private Material m_NormalMaterial;
[SerializeField] private Material m_OverMaterial;
[SerializeField] private Renderer m_Renderer;
[SerializeField] private VRInteractiveItem m_InteractiveItem;

//gaze timer stuff
private float gazeTime = 0.0f;
private bool counting = false;
private float gazeDelay = 1.0f;
private float initialOverTime = -1.0f;

//set the starting material
private void Awake (){
m_Renderer.material = m_NormalMaterial;
}

//subscribe to some events in VRInteractiveItem.cs
private void OnEnable(){
m_InteractiveItem.OnOver += over_gaze_target;
m_InteractiveItem.OnOut += leave_gaze_target;
}

private void OnDisable(){
m_InteractiveItem.OnOver -= over_gaze_target;
m_InteractiveItem.OnOut -= leave_gaze_target;
}
//count how long player has gazed at gaze target. stop counting if player 
//stops looking at target.
IEnumerator GazeTimerCoroutine(){
while (counting = true) {
gazeTime += Time.deltaTime;
Debug.Log ("gazeTime =" + gazeTime);
yield return new WaitForFixedUpdate();

if (gazeTime > 2f) {
trigger_gaze_target ();
gazeTime = 0;
yield break;
}
}
}

//player looks at gaze target..
void over_gaze_target () {
Debug.Log ("over target!");
m_Renderer.material = m_OverMaterial;
AudioSource audio = GetComponent<AudioSource> ();
if (!audio.isPlaying) {
audio.Play ();
}
counting = true;
StartCoroutine (GazeTimerCoroutine ());

initialOverTime = Time.realtimeSinceStartup;
float timeSinceFirstOver = Time.realtimeSinceStartup - initialOverTime;
}

//player stops looking at gaze target
void leave_gaze_target () {
Debug.Log ("left target!");
counting = false;
m_Renderer.material = m_NormalMaterial;
AudioSource audio = GetComponent<AudioSource> ();
audio.Pause ();
}

//player has looked continuously at target for at least 
void trigger_gaze_target () {
counting = false;
player.transform.position = portpoint;
playerPos = player.transform.position;
AudioSource.PlayClipAtPoint (audioClip, playerPos, volume);
Debug.Log ("player teleported!");
}

}

erica_layton
Expert Protege
Here's my demo video. Now, time to go get my keystore and sign this thing, so it can be submitted...
cqrtig8taqw3.png
https://www.youtube.com/watch?v=wuraOYPHank&feature=youtu.be