Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • 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 /
avatar image
0
Question by stevensu1838 · Jun 30, 2019 at 12:50 PM · gameobjecttransformcontrollervelocity

Cannot precisly get the Transform(position and rotation) and velocity of the HTC vive controller in Unity

Hi all, I am trying to use the movement of my vive controller to control something. So I want to read the Transform(position and rotation) and velocity of my HTC vive controller precisely. After I set up the steamvr plugin by selecting and dragging the [CameraRig] and [SteamVR] prefabs from the SteamVR\Prefabs folder to the Hierarchy, everything works well.

However, when the controller is firmly placed on the table without moving, the position keeps changing up and down slightly around the value. Like Position X, the number keeps changing between 0.3727 1587 and 0.3728456. The number is roughly around 0.3727, rough. As I explained in the beginning, I'd love to get the value of the position and velocity precisely. Do you have any suggestions?

When it comes to the velocity of the HTC vive controller, I made the following script and attached it to the Controller(right) game object. It does read the velocity but I have two problems here:

  1. The velocity keeps changing up and down slightly around the value. Like Velocity Y, the number keeps changing between -0.004792385 and -0.004795785.

  2. Sometimes really big values appear. Like Velocity x, it reached around 9.35334. Again, this happens when the controller is firmly placed on the table without moving. I've been trying on different PCs with different Vive devices. The same thing happens. I guess it is a problem with the device.

Can any of you kindly show me a way out? How shall I solve the unstable data reading of the controller when the actual controller is not moving at all. You can see my screenshots here link text Please see my velocity reader script to check out how I get the velocity of the controller My velocity reader script:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class ViveControllerInput : MonoBehaviour
 {
 //[HideInInspector]
 public Vector3 velocity; 
 //[HideInInspector]
 public Vector3 angularVelocity;
 
 private SteamVR_TrackedObject trackedObj;
 private SteamVR_Controller.Device Controller
 {
 get { return SteamVR_Controller.Input((int)trackedObj.index); }
 }
 
 void Awake()
 {
 trackedObj = GetComponent();
 }
 
 private void UpdateVelocity()
 {
 velocity = Controller.velocity;
 angularVelocity = Controller.angularVelocity;
 
 Debug.Log("Controller Velocity!" + velocity);
 }
 
 
 // Update is called once per frame
 void FixedUpdate()
 {
 UpdateVelocity();
 }
 }


Comment
Add comment
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

0 Replies

· Add your reply
  • Sort: 

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.

Follow this Question

Answers Answers and Comments

183 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

Related Questions

Unwanted gameObject movement after jumping. 1 Answer

Take final position after a force applied to a GameObject 1 Answer

Destroy Gameobject on Collision not working? 3 Answers

problems parenting a gameObject to another upon instantiating when same name exists 1 Answer

Keep adding targets to a list 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