Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 easilyBaffled · Aug 19, 2012 at 01:11 AM · rotationvector3axisrotatearound

Accouting for random rotations in Rotate Around

I have a randomly generating tube moving towards and around the camera along the z axis. The tube is maid up of strait pieces and curved pieces. The curve will approach the camera, with the rest of the tube extending outwards, in what ever direction the curve is bending towards(imagine a bendy straw). When the curve gets the camera it must rotate so that the following pieces will move strait towards the camera. Innitially I had it set up that each curve had a set pivot point, the whole tube would rotate around it so that everything was in a strait line again. But then I started having the tube rotate around the z axis randomly so that the tube with bend off in different directions. My problem is I can't figure out a consistent way to rotate the entire tube so that it will be strait after a curve. Can anyone think of a good way that can consistently turn it? I have a feeling that it could be solved by chaining the axis for rotate around, but I'm not sure the best way to manipulate it. This is the current code for it:

`transform.RotateAround (child.FindChild("Turn").FindChild("TurnChild").position, Vector3.right, -41.4276);`

I've added some pictures of what it looks like, 1. before the rotation, when not randomly rotated, 2. after rotation, when not randomly rotated

alt text alt text

screen shot 2012-08-18 at 9.02.35 pm.png (7.6 kB)
screen shot 2012-08-18 at 9.02.29 pm.png (9.8 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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by aldonaletto · Aug 19, 2012 at 02:29 AM

I'm not sure about exactly what you're trying to do, but suppose that you want the parts to behave like a single piece, rotating around some fixed pivot - am I right? If so, create an empty object at the pivot position and child all segments to it. Move or rotate the empty object, and all children will keep their relative position/rotation, behaving like a single object.

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 easilyBaffled · Aug 19, 2012 at 03:15 AM 0
Share

The good news is, your theory is right, the bad news is thats the part that I have working so far. the issue is the pivot point I have will be at a random xy coordinate when I need it, so once I found it I have to figure out axis to rotate it around. when the pivot point is directly up or down its Vector3.right, when directly left or right its Vector3.up. So I am looking for something that can take the pivot point's XY coordinate and give me a proper Vector3 axis to rotate around. Sorry my original question wasn't too clear.

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

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Are there more options to rotation 'Space' relativity? 1 Answer

Rotation to align between two vectors but with preserved Camera Z axis 0 Answers

Get angle around a specified axis. 1 Answer

Snap the rotation of object 2 Answers

How can I rotate a vector direction around an arbitrary axis? 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