Jump to content

stevensu1838@gmail.com

Verified Members
  • Posts

    1
  • Joined

  • Last visited

Reputation

0 Neutral

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 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? Thanks a million Please see fig1 and 2 to learn about the unstable data reading of the controller when the actual controller is not moving at all. 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<SteamVR_TrackedObject>();}private void UpdateVelocity(){velocity = Controller.velocity;angularVelocity = Controller.angularVelocity;Debug.Log("Controller Velocity!" + velocity);}// Update is called once per framevoid FixedUpdate(){UpdateVelocity();}}
×
×
  • Create New...