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 garrilla · Apr 13, 2016 at 05:34 PM · rotatepivotquaternionseulerroll

Quaterinon.Euler(0,0,somevalue) has no effect when rotating around a point

I'm doing a Yaw-Pitch-Roll type moving a gameobject around a pivot.

I'm using a RotatePointAroundPivot function (taken from this forum)

     private Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
     {
         Vector3 dir = point - pivot; // get point direction relative to pivot
         dir = Quaternion.Euler(angles) * dir; // rotate it
         point = dir + pivot; // calculate rotated point
         return point; // return it
     }

Any combination of Pitch or Yaw (angles.x or angles.y) works fine but Roll (angles.z) has no effect.

Can anyone explain? help me? etc.

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 TBruce · Apr 13, 2016 at 05:54 PM

@garrilla Have you considered using Transform.RotateAround()? But instead of using Vector3.zero you can replace it with the position of your object which I am assuming here is the Vector3 point.

And if this is not what you are looking for take a look at this link Yaw-Pitch-Roll.

Comment
Add comment · Show 3 · 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 garrilla · Apr 13, 2016 at 06:15 PM 0
Share

Thanks @$$anonymous$$avina Yea, you're right on the point being the object...

I thought about rotateAround() but it doesn't really do what I'm wanting because my rotation might be (45, 135, 270) to pick three randomish numbers

Imagine the pivot is the center of sphere, and then I'm rotating the object around the surface of the sphere... so I want all three rotations at once

For the yaw and $$anonymous$$ch it works fine, but not the roll. which is just puzzling to me.

avatar image TBruce garrilla · Apr 13, 2016 at 07:03 PM 0
Share

Did you exa$$anonymous$$e the Yaw-$$anonymous$$ch-Roll script in the provided link? Your script passes

avatar image garrilla TBruce · Apr 14, 2016 at 08:14 AM 0
Share

Sorry, yes I have seen the blog.

It doesn't help directly in that it is yaw-pitch-rolling about the object's center, when I want to yaw pitch and roll around an offset pivot point... although I have had an alternative based on that approach that produces the same result - really what is different is that it assigns the Euler Angles directly rather calculating them with the Eurler method.

Another solution I tried was to apply the go.transform.RotateAround(myPosition, Vector3.forward, myEuler.z); which a rolls the object around the pivot but also around it's center, which is not the effect I want.

Thanks!

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

55 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

Related Questions

Why Quaternion.Euler can't rotate 360 Degrees 0 Answers

Roll cuboid does not work properly 1 Answer

Change pivot point of gameobject 5 Answers

Reversed Rotation Problem 1 Answer

How to rotate a child object independently from it's parent so that it maintains it's transform integrity and shape 0 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