• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
Question by bomerman104 · May 14, 2019 at 05:51 AM · vrsteam2.0

SteamVR 2.0 how to get trackpad input

I'm a little desperate for help here as I cannot for the life of me figure out how to get this stuff working. essentially what I'm trying to do is get the trackpad input from the controller to move the player in the direction that the trackpad is being pressed. I'm struggling to figure out how to actually get the vector input from the track pad and actually do something with it. I have set-up the Action set for the track pad in the SteamVR Input under the default action set however I am lost after this point

Comment

People who like this

0 Show 0
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image

Answer by bomerman104 · May 14, 2019 at 07:16 PM

So I managed to figure out how to get the input from the track pad using the following code.

using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; using Valve.VR.InteractionSystem;

public class VRController : MonoBehaviour { //variables controlling the the character speed of the player public float m_Sensitivity = 0.1f; public float m_MaxSpeed = 1.0f;

 //Variable for grabbing the desired actionset
 public SteamVR_ActionSet m_ActionSet;

 // varaibles for storing if the touchpads have been used on the controller
 public SteamVR_Action_Vector2 m_TouchPosition;

 // varaible for storing player speed
 private float m_Speed = 0.0f;

 // varaible for storing the character controller
 private CharacterController m_CharacterController = null;

 //location values for the player position and the head position
 private Transform m_CameraRig = null;
 private Transform m_Head = null;

 

 
 //sets the deadzone for how far the player needs to move their thumb before
 public Vector2 m_deadzone = new Vector2(0.1f,0.1f);
 public Vector2 m_NeutralPosition = new Vector2(0.0f,0.0f);

 private void Awake()
 {
     m_CharacterController = GetComponent<CharacterController>();

 }

 // Start is called before the first frame update
 void Start()
 {
     m_CameraRig = SteamVR_Render.Top().origin;
     m_Head = SteamVR_Render.Top().head;
 }

 // Update is called once per frame
 void Update()
 {
     HandleHead();
     CalculateMovement();
     HandleHeight();

     #region Vector2 Action
     Vector2 delta = m_TouchPosition[SteamVR_Input_Sources.LeftHand].delta;

     if(delta.x >=  (m_NeutralPosition.x + m_deadzone.x) && delta.y >= (m_NeutralPosition.y + m_deadzone.y))
     {
         Debug.Log("Player is moving right and up");
     }
     #endregion
 }

however from here I have kind of hit another dead end as I'm not sure how to move the character based on the direction the thumb is on the touchpad.

Comment

People who like this

0 Show 0 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

204 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

SteamVR 2.0 how to implement distance grab? 2 Answers

How to use SteamVR plugin when using a wireless adapter from HTC on the Vive 0 Answers

Steam VR HTC Vive: When I change scenes, the Vive controller is no longer tracking positions. 1 Answer

Steam VR Teleport Reticle Off Set? 0 Answers

Spawn object in hand and bind it to hand transform? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges