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 unity_PfHgO2CCqrgBHA · Jun 20, 2019 at 10:27 AM · rotationchildrencamera-lookminimap

Object rotation as a children of the main camera

Hello,

I have a problem with the rotation of an object (simple arrow for the minimap). The object is attached to the camera as a children, so it takes the movement and the rotation from there. What i would like to do, is to make the object stop rotating up and down only left and right.(I tried with Rigidbody freeze rotation on X, but it`s not working) I would attache the arrow as a children to the FPSController, but I`m using Cinemachine in this scene so I need to attache to the main camera. thank you for your answers in advance! Have a nice day, Tamas

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by highpockets · Jun 20, 2019 at 10:39 AM

You could just point in the same direction constrained to the plane you want via Vector3.ProjectOnPlane().

 Vector3 direction = Vector3.ProjectOnPlane(Camera.main.transform.forward, Vector3.up);
 Quaternion rot = Quaternion.LookRotation(direction, Vector3.up);
Comment
Add comment · Show 7 · 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 unity_PfHgO2CCqrgBHA · Jun 20, 2019 at 10:51 AM 0
Share

@highpockets thank you for your answer, I put this lines of code in a script on the object, but unfortunately this changes nothing.

avatar image highpockets unity_PfHgO2CCqrgBHA · Jun 20, 2019 at 10:53 AM 0
Share

@unity_PfHgO2CCqrgBHA are you passing the rotation to the arrow object?

Probably best you upload your script

avatar image unity_PfHgO2CCqrgBHA highpockets · Jun 20, 2019 at 11:06 AM 0
Share

I have a dolly track in my scene, a vcam witch is following the track (it`s a simple walkthrough) and I have a $$anonymous$$inimap to show the user where is he exactly in the apartment. you can look around using the mouse, but can`t control the movement of the character. what i want is to rotate the arrow as you look around (if you look at the door the arrow must face to the door) right now works fine, when i move my mouse to the right the arrow turns right, if look to the left, turns left, but the problem is when i look up, or down the arrow follows the camera, and i don`t need that . I hope that this way is more understandable, I`m quite new in unity without any program$$anonymous$$g background, so I don`t know where to put your question, sorry

Show more comments

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

142 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

Related Questions

Instantiate GameObject to specific position on the Parent 2 Answers

Rotation Complications + rotation with parents and children? 1 Answer

Is it possible to rotate a child object regardless of the parent rotation ? 1 Answer

How to fix the rotation and Orientation in an object as a Children ? 1 Answer

A little help with this camera script please? 3 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