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 /
  • Help Room /
avatar image
0
Question by astaude · Aug 22, 2017 at 11:40 AM · editortransformruntimetracking

Transform shows in Scene View on Runtime, but not in Camera (also: Vive Trackers)

Hi there,

I am currently working with a Vive Tracker to bring a drawer into Virtual Reality. To adjust the position and rotation of the mounted tracker in relation to the drawer, I took an example script from the Vive Tracker Guidelines (Page 29) and adjusted it slightly so that it now looks like this:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using Valve.VR;
 
 public class Accessory : MonoBehaviour {
 
  
     // Define Offset and Rotation in Unity Editor
     public float dX = 0.0f;
     public float dY = 0.0f;
     public float dZ = 0.0f;
     public float roll = 0.0f;
     public float yaw = 0.0f;
     public float pitch = 0.0f;
 
 
 /*
     // Define Offset and Rotation in Unity Editor
     const float dX = 0.0f;
     const float dY = -0.61f;
     const float dZ = 0.0f;
     const float roll = 0.5f;
     const float yaw = 90.0f;
     const float pitch = 0.3f;
 */
 
       
     // Choose Tracking Device in Editor
     public enum EIndex
     {
         None = -1,
         Hmd = (int)OpenVR.k_unTrackedDeviceIndex_Hmd,
         Device1,
         Device2,
         Device3,
         Device4,
         Device5,
         Device6,
         Device7,
         Device8,
         Device9,
         Device10,
         Device11,
         Device12,
         Device13,
         Device14,
         Device15
     }
     
 
     public EIndex index;
 
     
 
     void Update()
     {
         //Use chosen Tracker
         var i = (int)index;
 
         //Collect delta rotation and displacement between Tracker and Accessory
         Vector3 delta_displacement = new Vector3(dX, dY, dZ);
         Quaternion delta_rotation = Quaternion.Euler(roll, yaw, pitch);
 
         //Get current Tracker pose
         Vector3 tracker_position = SteamVR_Controller.Input(i).transform.pos;
         Quaternion tracker_rotation = SteamVR_Controller.Input(i).transform.rot;
 
         //Transform current Tracker pose to Accessory pose
         GameObject.Find("Accessory").transform.rotation = tracker_rotation * delta_rotation;
         GameObject.Find("Accessory").transform.position = tracker_position + (tracker_rotation * delta_rotation) * delta_displacement;
     }
 }
 



alt text alt text

This is supposed correct the stance of the drawer in relation to the vive tracker. Here's the problem: Activating the script changes position and rotation auf the drawer the right way in the Scene Window if I start the Application. The game view and the vive however still show the old transform of the drawer, as if my accessory script had never happened. I never had such a difference between Scene and Game view on runtime. Maybe somebody knows why this is happening? I don't know if it's an issue related to Vive and the trackers or not.

If you need additional info, let me know!

Big thanks in advance, Adrian

accessory-on-s.png (404.1 kB)
accessory-off-s.png (398.9 kB)
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

143 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

Related Questions

transform.lookat not working? 0 Answers

Hi, I'm new to unity. In Unity Editor, Inspector, local transform are being shown, I want to view the default transform options, but I can't find any way to do it. Please see the image below! 1 Answer

Boss won't track player movement 2 Answers

UI Editor & Gizmos in Runtime 0 Answers

Track only closest enemy transform 1 Answer


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