Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 designico · Jun 08, 2014 at 05:23 PM · rotationlocaleuleranglesconstrain

Constrain XZ while setting local Y-rotation free. How?

Hi there,

I have a game object that should be contraint to another game object's rotation. But I want this game object to able to freely rotate around it's own Y axis. (Because I want to rotate this game object via rigidbody.AddRelativeTorque later).

I tried around with transform.localEulerAngles and transform.eulerAngles e.g:

 transform.localEulerAngles = new Vector3(planetaryOrientation.localEulerAngles.x, transform.localEulerAngles , planetaryOrientation.localEulerAngles.z);

But all attempts couldn't manage to do what I need. The "free" axis is never the local Y axis of the game object, but seams to be the Y axis in world space.

Is there maybe an other way to set a special local axis free while the other axis are constrait to another game object??

Comment
Add comment · Show 4
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 fafase · Jun 08, 2014 at 05:44 PM 0
Share

Could you describe the situation some more? $$anonymous$$nowing what you are after would allow to give a more appropriate answer.

Here I could tell you to apply the rotation of the top object to the sub object and then apply a rotation to the sub object on the axis by the amount needed, but they could be better ways.

avatar image designico · Jun 09, 2014 at 12:10 PM 0
Share

Okay, I'm working on a game that is arranged in a planetary gravity setup. The player is attached to a game object that is always orientated parallel to the planets surface. But I need the player to be able to move freely around it's own Y axis while it is attached to the other gameobject, because I want to rotate it by using rigidbody.AddRelativeTorque. The player is a rigidbody of course.

avatar image MrFijiWiji · Jun 09, 2014 at 12:16 PM 0
Share

So you want only the player to be constrained on the x and z axis if i'm understanding this correctly. Have you tried setting the players rigidbody "freeze rotation" constraints to stop rotation on these two axes?

avatar image designico · Jun 09, 2014 at 06:18 PM 0
Share

Hey - thank you but this is not what I need. Sorry for my english.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Kiwasi · Jun 09, 2014 at 07:38 PM

Hinge Joints do exactly that

Comment
Add comment · Show 2 · 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 designico · Jun 10, 2014 at 02:35 PM 0
Share

I'm not sure if that might be compatible with my setup, but I'll give it a try and tell you later if this is the solution. THX!

avatar image designico · Jun 11, 2014 at 06:13 PM 0
Share

Hinge Joints seams to be a solution, but in my case it isn't. The joint needs a connected body with a rigidbody, but my other game object hasn't a rb and even if I try to give it one, the rotation is not how it should be.

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

23 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

Related Questions

localeulerangles changes global angles? 1 Answer

Constrain object rotation set by mouse? 1 Answer

Setting an objects angle about a local axis without localEulerAngles? 0 Answers

localEulerAngles.x rotates as in world space 1 Answer

How to Constrain Quaternion Rotations Over Time? 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