cancel
Showing results for 
Search instead for 
Did you mean: 

Anyone have a touch only movement script that's ready to go?

vrguy2
Protege
I just made a demo but I feel I am making some not so great of choices on the movement scheme.

I've seen a few demos where sliding the touchpad on the side of the Gear VR forward will walk forward, back for backward, no strafing. Does anyone have an intuitive touchpad-only movement scheme script they'd be willing to share that works like this? I am not that good with Unity quite yet to recreate this and I would prefer to avoid requiring the controller if possible.

Something that would also allow for selecting items using head-gaze would be ideal. I would like to make a sitting position and standing position toggle with the touchpad too (perhaps a menu if you hold the pad down for these options). I know there are probably other devs out there that are also looking for something similar (kind of like how the Oculus Utilities has almost everything mapped and nearly ready to go, but instead for touchpad first person movement) This would be greatly appreciated, I am looking for any touchpad only movement script to help make this experience better!

Edit: Just tried the OVRtouchpad.cs script, it has an error though: "The class named 'OVRTouchpad' is abstract. The script class can't be abstract!" I figured this might be a good starting point, but not having any luck.
2 REPLIES 2

BrianNew
Honored Guest
if(Input.GetMouseButton(0)) // If finger touching touchpad.
{
// If a static or forward swipe on touchpad, then...
if(Input.GetAxis ("Mouse X") <= 0f) { moveForward = true; } else moveBack = true;


This is all I use.

The touchpad is mapped onto the mouse.

So, touching it will walk you forward, or dragging a finger slowly backward, will walk you back.

(The walking backwards part is rubbish, sorry -- just as little hack job.)

Paste this into OVRPlayerController, just underneath where you see #if UNITY_ANDROID (around line 250).

vrguy2
Protege
Thanks, but unfortunately did not work for me. I tried pasting it in but it seemed to only make me about 20 ft higher in the air?

This is what my ovrplayercontroller.cs file says:

#if !UNITY_ANDROID || UNITY_EDITOR
if (!SkipMouseRotation)
euler.y += Input.GetAxis("Mouse X") * rotateInfluence * 3.25f;
if(Input.GetMouseButton(0)) // If finger touching touchpad.
{
// If a static or forward swipe on touchpad, then...
if(Input.GetAxis ("Mouse X") <= 0f) { moveForward = true; } else moveBack = true;


#if !UNITY_ANDROID || UNITY_EDITOR
if (!SkipMouseRotation)
euler.y += Input.GetAxis("Mouse X") * rotateInfluence * 3.25f;
if(Input.GetMouseButton(0)) // If finger touching touchpad.
{
// If a static or forward swipe on touchpad, then...
if(Input.GetAxis ("Mouse X") <= 0f) { moveForward = true; } else moveBack = true;
#endif

moveInfluence = SimulationRate * Time.deltaTime * Acceleration * 0.1f * MoveScale * MoveScaleMultiplier;

#if !UNITY_ANDROID // LeftTrigger not avail on Android game pad
moveInfluence *= 1.0f + OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftTrigger);
#endif

float leftAxisX = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftXAxis);
float leftAxisY = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.LeftYAxis);

if(leftAxisY > 0.0f)
MoveThrottle += ort * (leftAxisY * moveInfluence * Vector3.forward);

if(leftAxisY < 0.0f)
MoveThrottle += ort * (Mathf.Abs(leftAxisY) * moveInfluence * BackAndSideDampen * Vector3.back);

if(leftAxisX < 0.0f)
MoveThrottle += ort * (Mathf.Abs(leftAxisX) * moveInfluence * BackAndSideDampen * Vector3.left);

if(leftAxisX > 0.0f)
MoveThrottle += ort * (leftAxisX * moveInfluence * BackAndSideDampen * Vector3.right);

float rightAxisX = OVRGamepadController.GPC_GetAxis(OVRGamepadController.Axis.RightXAxis);

euler.y += rightAxisX * rotateInfluence;

transform.rotation = Quaternion.Euler(euler);
}



I also tried pasting it in the bottom section after that but did not work either. Any ideas?