Dive Board



autowalk solved

autowalk solved

by crow34 on Jan 5th, 2015 07:12 AM

I found a solution that allows developers to autowalk like the Tuscany dive demo

Place a sphere above or below the main camera and create a autowalk.cs with the following script

And you will need to apply a character controller and a fpscontroller

https://www.dropbox.com/s/2r8j7xp56pupv ... lk.cs?dl=0

using UnityEngine;<br />using System&#46;Collections;<br /><br />public class Autowalk &#58; MonoBehaviour {<br /><br />	private CardboardHead head;<br />	private Vector3 startingPosition;<br />	private float delay = 0&#46;0f; <br /><br />	void Start() {<br />		head = Camera&#46;main&#46;GetComponent&lt;StereoController&gt;()&#46;Head;<br />		startingPosition = transform&#46;localPosition;<br />	}<br />	<br />	void Update() {<br />		RaycastHit hit;<br />		bool isLookedAt = GetComponent&lt;Collider&gt;()&#46;Raycast(head&#46;Gaze, out hit, Mathf&#46;Infinity);<br />		// if looking at object for 2 seconds, enable/disable autowalk<br />		if (isLookedAt &amp;&amp; Time&#46;time&gt;delay) { <br />			GameObject FPSController = GameObject&#46;Find(&quot;Head&quot;);<br />			FPSInputController autowalk = FPSController&#46;GetComponent&lt;FPSInputController&gt;();<br />			autowalk&#46;checkAutoWalk = !autowalk&#46;checkAutoWalk;<br />			delay = Time&#46;time + 2&#46;0f;<br />		}<br />		// currently looking at object<br />		else if (isLookedAt) { <br />			GetComponent&lt;Renderer&gt;()&#46;material&#46;color = Color&#46;yellow; <br />		} <br />		// not looking at object<br />		else if (!isLookedAt) { <br />			GetComponent&lt;Renderer&gt;()&#46;material&#46;color = Color&#46;red; <br />			delay = Time&#46;time + 2&#46;0f; <br />		}<br />	}<br />	<br />}

crow34

Posts: 21

Joined: 29.01.2014

dive-owner


Re: autowalk solved

by Juju on Jan 6th, 2015 23:33 PM

Hey, thaks for the solution, this is exactly what I was looking for.
I'm a total beginner with Unity and I am writing an Cardboard App very similar to the Tuscany dive app. Could you please tell me how I create the fps controller and the charactercontroller and what I have to write into these scripts?

Thanks alot.

Juju

Posts: 1

Joined: 06.01.2015


Re: autowalk solved

by crow34 on Jan 7th, 2015 10:16 AM

It appears that bacongames has beat me to the finish line

Search the asset store for no click GUI this will provide you with a working autowalk feature

crow34

Posts: 21

Joined: 29.01.2014

dive-owner


Re: autowalk solved

by monome on Jan 15th, 2015 03:55 AM

Hey everyone for some reason I am getting a compiling error. Any ideas. Could someone possible post a pre built character for me to take a look at? Thanks for any input.

monome

Posts: 1

Joined: 15.01.2015


Re: autowalk solved

by Refref1990 on Aug 9th, 2015 20:16 PM

Hi! I have created a game with the autowalk, but i want who the circle with the script be under my feet, like tuscany dive. But when i put the circle under my feet, in the same folder of the cameras, this follow my head, so when i try to see, the cirlce go behind my head. Any solutions?

Refref1990

Posts: 5

Joined: 09.08.2015


Re: autowalk solved

by Glocksilverna on Oct 5th, 2015 06:31 AM

A point that I was interested in a joint comment.

Glocksilverna

Posts: 2

Joined: 05.10.2015


STATISTICS


Total posts: 2944


Total topics: 562


Total members: 23514


Newest member: Daniel G.