Dive Board



Head Axis Demo

Head Axis Demo

by treebolt on Aug 1st, 2014 05:05 AM

First post! =D

I've tried many demos since creating my cardboard a couple weeks ago. I noticed there are a couple of ways to handle player body rotation, either physically rotate your whole physically body, or use a controller axis to rotate the virtual body. I didn't really like either of these experiences and wanted to be able to rotate my virtual body using the rotation of my physical head. I haven't seen a demo yet use this method, so I created this in Unity.

Here is my demo. You will need a controller (I am using an Xbox 360 controller connected to my S3 via OTG cable). After you launch, the first thing you want to do is face forward and press "joystick button 0", for me that's A button. This is to calibrate center axis rotation. Press this regularly throughout the demo if you feel off balance but don't hold this button in.

https://drive.google.com/file/d/0B0UKIs ... sp=sharing

Controls:
X / Y axis (or top left joystick on xbox controller) - move / strafe
joystick button 0 (or A button on xbox controller) - calibrate center rotation
joystick button 2 (or X button on xbox controller) - reset demo
joystick button 3 (or Y button on xbox controller) - jump
joystick button 5 (or R1 button on xbox controller) - show extra info

A bug I have noticed and can't seem to fix (not sure if this is the 'drift' issue I see people talking about?) as I move around, the yRotation seems to be affected slightly, even though I'm only moving in the x and z planes. This is why constant calibration of center rotation is needed. You can see what I'm talking about if you hold down the show extra info button and strafe forever. The y rotation is affected when it shouldn't be.

Anywho, what do you guys think about this concept of VR traversing? If people want it enough I'll open source the code / unity project.

P.S. it is possible to get on top of the buildings if you try hard enough ^_~

treebolt

Posts: 6

Joined: 01.08.2014


Re: Head Axis Demo

by jpslara on Aug 1st, 2014 13:31 PM

I will try your demo when I get home this night, but I like to know how you reset (calibrate) Y rotation.
I like rotate using head and right joystick from gampad, and I have use this technique to control the player in AngrybotsVR demo, I thing that this is a good way to control the player, because you can play why sitting or you can play standing and rotate your own body.

"treebolt" wrote:
Anywho, what do you guys think about this concept of VR traversing? If people want it enough I'll open source the code / unity project.


I like to review how you make this "calibrate"

jpslara

Posts: 80

Joined: 27.12.2013

dive-owner


Re: Head Axis Demo

by jpslara on Aug 1st, 2014 20:37 PM

hi, I have tested it, and I have been surprise about the way you control rotation Y axis, From my point of view, when you look over right or left, the view begin to rotate and stop after you look to from again. well I don't link this way, but it is curious. by other hand, I think that direction is bad, when I look right feel that view move left and viceversa.

I don´t get any response from my idroid snakebyte gamepad other than X / Y axis to move / strafe.

jpslara

Posts: 80

Joined: 27.12.2013

dive-owner


Re: Head Axis Demo

by treebolt on Aug 3rd, 2014 19:37 PM

hi, I have tested it, and I have been surprise about the way you control rotation Y axis, From my point of view, when you look over right or left, the view begin to rotate and stop after you look to from again. well I don't link this way, but it is curious. by other hand, I think that direction is bad, when I look right feel that view move left and viceversa.



Thanks for testing and giving feedback! Using the joystick to rotate is easier and more intuitive I suppose. But it was a fun experiment regardless =P

I like to review how you make this "calibrate"



Here is how I did calibration:



http://imgur.com/0MLTTPc

The dive camera is attached to the first person controller that comes with Unity. The dive camera's "Add_rotation_gameobject" is set to true and the object is RotationController. So, as RotationController rotates, the dive camera will rotate accordingly. There is a script on RotationController that looks for head movement and rotates this object accordingly. The part of the script that handles calibration is shown. Basically it gets the difference in Y angle between dive camera's rotation and CenterReference, and adds the rotation to CenterReference, an empty game object that is a child of RotationController.

LMK if you want to know anything else.

Kinda sad this concept didn't take off like I thought it would. But it was a fun project.

treebolt

Posts: 6

Joined: 01.08.2014


Re: Head Axis Demo

by treebolt on Aug 3rd, 2014 19:58 PM

Here is another demo with settings tweaked to make things more sensitive. I really hope more people will try and give me input on this control method.

https://drive.google.com/file/d/0B0UKIs ... sp=sharing

EDIT: and here is the full script for RotationController if it helps:

#pragma strict<br /><br />var axisText &#58; GameObject;<br />internal var clone_rotationText &#58; GameObject;<br />internal var clone_deadText &#58; GameObject;<br />internal var clone_sensitivityText &#58; GameObject;<br />internal var clone_angleYDiff &#58; GameObject;<br />internal var clone_headAxis &#58; GameObject;<br /><br />internal var Dive_Camera &#58; GameObject;<br />internal var CenterReference &#58; GameObject;<br /><br />internal var yRotation &#58; float; //the read value<br />internal var angleYdiff &#58; float; //the angle difference between the dive camera and center reference<br />internal var headAxis &#58; float; // our head is now a joystick<br /><br />internal var amountToRotate &#58; float; // if we are outside the deadzone, this is far we need to rotate<br />var amountToRotateMultiplier &#58; float = 8; // adding value to this will make us rotate faster<br /><br />var dead &#58; float = 0&#46;3; //deadzone threshold where head rotation doesn't affect headAxis<br />var sensitivity &#58; float = 1; //sensitivity of rotation value<br /><br />function Start () {<br />	<br />	//create our guitext prefabs<br />	clone_rotationText = Instantiate(axisText, Vector3(0&#46;4,0&#46;42,0), Quaternion&#46;identity);<br />	clone_deadText = Instantiate(axisText, Vector3(0&#46;4,0&#46;47,0), Quaternion&#46;identity);<br />	clone_sensitivityText = Instantiate(axisText, Vector3(0&#46;4,0&#46;52,0), Quaternion&#46;identity);<br />	clone_angleYDiff = Instantiate(axisText, Vector3(0&#46;4,0&#46;57,0), Quaternion&#46;identity);<br />	clone_headAxis = Instantiate(axisText, Vector3(0&#46;4,0&#46;62,0), Quaternion&#46;identity);<br />	<br />	//find our camera and the center reference<br />	Dive_Camera = GameObject&#46;Find(&quot;Dive_Camera&quot;);<br />	CenterReference = GameObject&#46;Find(&quot;CenterReference&quot;);<br /><br />}<br /><br />function Update () {<br />	<br />	//look at current rotation value from the dive camera<br />	yRotation = Dive_Camera&#46;transform&#46;eulerAngles&#46;y; //read the value<br />	<br />	//Find the difference in Y angle between the dive camera and center reference<br />	angleYdiff = Mathf&#46;Asin(Vector3&#46;Cross(Dive_Camera&#46;transform&#46;forward, CenterReference&#46;transform&#46;forward)&#46;y) * Mathf&#46;Rad2Deg;<br />	<br />	//Get our head axis<br />	headAxis = (angleYdiff / 90) * sensitivity;<br />	<br />	//If we are out of the deadzone, rotate the controller<br />	if (headAxis &gt; dead || headAxis &lt; -dead) {<br />		<br />		//determine if we are facing left or right<br />		if (headAxis &gt; 0) {<br />			amountToRotate = -((headAxis - dead) * amountToRotateMultiplier);<br />		} else {<br />			amountToRotate = -((headAxis + dead) * amountToRotateMultiplier);<br />		}<br />		<br />		//do the rotation<br />		transform&#46;Rotate(Vector3(0,amountToRotate,0));<br />	}<br />	<br />	/////////////////////////////////<br />	// Controls<br />	/////////////////////////////////<br />	<br />	//get center reference<br />	if (Input&#46;GetButton(&quot;GetCenterReference&quot;)) {<br />		var amountToRotate = Dive_Camera&#46;transform&#46;eulerAngles&#46;y - CenterReference&#46;transform&#46;eulerAngles&#46;y;<br />		CenterReference&#46;transform&#46;Rotate(Vector3(0,amountToRotate,0));<br />	}<br />	<br />	//show some details<br />	if (Input&#46;GetButton(&quot;ShowInfo&quot;)) {<br />	<br />		//update gui values<br />		clone_rotationText&#46;GetComponent(GUIText)&#46;text = &quot;Y angle&#58; &quot; + yRotation&#46;ToString();<br />		clone_deadText&#46;GetComponent(GUIText)&#46;text = &quot;Deadzone&#58; &quot; + dead&#46;ToString();<br />		clone_sensitivityText&#46;GetComponent(GUIText)&#46;text = &quot;Sensitivity&#58; &quot; + sensitivity&#46;ToString();<br />		clone_angleYDiff&#46;GetComponent(GUIText)&#46;text = &quot;Y angle diff&#58; &quot; + angleYdiff&#46;ToString();<br />		clone_headAxis&#46;GetComponent(GUIText)&#46;text = &quot;Head Axis&#58; &quot; + headAxis&#46;ToString();<br />		<br />		//show the values<br />		clone_rotationText&#46;GetComponent(GUIText)&#46;enabled = true;<br />		clone_deadText&#46;GetComponent(GUIText)&#46;enabled = true;<br />		clone_sensitivityText&#46;GetComponent(GUIText)&#46;enabled = true;<br />		clone_angleYDiff&#46;GetComponent(GUIText)&#46;enabled = true;<br />		clone_headAxis&#46;GetComponent(GUIText)&#46;enabled = true;<br />		<br />	} else {<br />	<br />		//hide the values<br />		clone_rotationText&#46;GetComponent(GUIText)&#46;enabled = false;<br />		clone_deadText&#46;GetComponent(GUIText)&#46;enabled = false;<br />		clone_sensitivityText&#46;GetComponent(GUIText)&#46;enabled = false;<br />		clone_angleYDiff&#46;GetComponent(GUIText)&#46;enabled = false;<br />		clone_headAxis&#46;GetComponent(GUIText)&#46;enabled = false;<br />	<br />	}<br />	<br />}

treebolt

Posts: 6

Joined: 01.08.2014


Re: Head Axis Demo

by treebolt on Aug 4th, 2014 10:53 AM

Here is the full unity project if anyone is interested.

https://mega.co.nz/#!Eg5mVLjA!jYesuf4Gf ... 5GxJKVZFzo

I did come across a video of another mechanism I like, I may want to use a hybrid of the two

https://www.youtube.com/watch?v=GR-lf0cKKkY

treebolt

Posts: 6

Joined: 01.08.2014


Re: Head Axis Demo

by AmandaReece on Jul 19th, 2024 10:15 AM

Dans un jeu explorant les profondeurs de la solitude, les joueurs naviguent dans un monde désolé où les liens humains sont rares. Cette expérience immersive permet aux joueurs de confronter leurs émotions intérieures et de trouver un sens à l'isolement. Le récit se concentre sur l’impact profond de la solitude, invitant les joueurs à réfléchir à leurs propres expériences. Pour ceux qui sont intéressés par des expériences de jeu avec des thèmes uniques, pensez à visiter https://hmcasinosburkinafaso.com/casino/imperial-casino-review pour explorer différentes options. L'approche de ce jeu sur la solitude propose un voyage stimulant à travers les complexités des émotions humaines et de la découverte de soi.

AmandaReece

Posts: 75

Joined: 20.01.2023


STATISTICS


Total posts: 144362


Total topics: 34841


Total members: 42384


Newest member: Daniel G.