• 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 arkea · Oct 29, 2015 at 10:38 AM · camerarotationvrmovingrotation axis

I have some Rotation problems

Hi everyone !

I wish someone could help me because if not i'm stuck forever :(

I'm making a Vr App and i've some probleme for the rotation of my object :

I've made a capsule for my character and I use the CardboardAdapter prefab. I didn't made the capsule a c$$anonymous$$ld or a parent of the camera because i never succeed to update the rotation of the Capsule(w$$anonymous$$ch have the script making going forward) by those of the camera and so i couldn't going where i was looking.

So i have two distinct object :

  • the MainCamera (with CardboardAdapter as a c$$anonymous$$ld)

  • and my Capsule

I've wrote those two scripts :

  • One in JS w$$anonymous$$ch make the capsule taking the rotation.y of the Camera)

  • One in C# w$$anonymous$$ch make the Camera following the capsule transform.position with an offset

But i have some problemes it doesn't work for all the angles so i told myself i juste have to log the rotation.y of both objects on the game screen in realtime for seeing what's happening but it always log the same so there is not the problem here :/ And when i make the rotation of the CardboardAdapter differently before making the simulation, it make the capsule following the rotation of the CardboardAdapter more and more slowly( for example MAin Camera set to 180° and capsule to 50°, i launch simulation and directly the capsule goes to 175 and very slowly goes to 180°)

So i hope someone can understand my so good english :/ (Sorry I'm French)

There are the scripts :

/////

the JS script attached to the caps

 var rb : Rigidbody;
 var cameraRotat : Transform ;
 var capsRotat : Transform;
 var Adapt : GameObject;
          
              
 function Start()
 
 {
     rb = GetComponent.<Rigidbody> ();
 }
 
 
 function FixedUpdate()
 
 { 
     capsRotat = GetComponent.<Transform> ();
     cameraRotat = GetComponentInParent.<Transform> ();
     
 
     
     rb.MovePosition (t$$anonymous$$s.transform.position + transform.forward * Time.deltaTime * 3);
     
     transform.rotation.y = Adapt.transform.rotation.y;
 }

///////////////////

And the C# attached to the MainCamera

 public GameObject caps;
 public int i;
 public Vector3 offset;

 void Start () {

     offset = transform.position - caps.transform.position; 

 }

 void FixedUpdate () {

     transform.position = caps.transform.position + offset;

 }

Comment
Add comment · Show 8
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
avatar image centaurianmudpig · Oct 29, 2015 at 10:44 AM 0
Share
avatar image centaurianmudpig · Oct 29, 2015 at 11:45 AM 0
Share
avatar image arkea · Oct 29, 2015 at 12:19 PM 0
Share
avatar image arkea · Oct 29, 2015 at 12:50 PM 0
Share
avatar image centaurianmudpig arkea · Oct 29, 2015 at 01:38 PM 0
Share
avatar image arkea · Oct 29, 2015 at 02:09 PM 0
Share
avatar image centaurianmudpig arkea · Oct 29, 2015 at 03:04 PM 0
Share
Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by arkea · Oct 29, 2015 at 10:57 AM

no that is not what i want. The capsule is under the camera and she follow $$anonymous$$s local z axis and the camera follow the position of the capsule just for staying above the capsule

Comment
Add comment · Show 1 · 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
avatar image arkea · Oct 29, 2015 at 11:37 AM 0
Share

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

38 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

Related Questions

Quaternion Roation Mouse Script 0 Answers

Fix rotation skipping 0 Answers

Camera self rotation script problem 1 Answer

Rotate camera like VR on mobile 3 Answers

Switch between touchscreen and Google VR to control the Unity camera 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