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
1
Question by lixpoxx · Aug 13, 2013 at 11:36 AM · gameobjectrotateyxz

Rotating GameObject problem

Hey! I'm making a game for Android and i want to make coins for it. Now i have a problem. I want to have 2 cubes spinning inside a cube but they don't rotate like i want. I made a big Over-Object, that holds them together: coin 1 2 3

I want all together to rotate around the y axis and every seperate to rotate around its own z axis. here is how i mean it;D (Pain(t))here is how i mean it

skizze.png (12.0 kB)
Comment
Add comment · Show 2
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 lixpoxx · Aug 13, 2013 at 12:46 PM 0
Share

Thanks everybody problem solved :D

lixpoxx

avatar image CHPedersen · Aug 13, 2013 at 12:48 PM 0
Share

No problem, glad you got it working. I have converted your answer to a comment as it was more suited for that. :) I've also upvoted your question since I thought it was pretty clear from the text and image what you were asking. With your new reputation, you should now be able to comment, upvote and mark as answer. Welcome to Unity Answers!

4 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by CHPedersen · Aug 13, 2013 at 11:40 AM

You have to write 2 different scripts: One to rotate the entire system, and one to rotate each individual coin. You could call them RotateCoinScript and RotateCoinSystemScript.

RotateCoinSystemScript would have an Update method that calls this:

     float rotationSpeed = 10;
     transform.RotateAroundLocal(Vector3.up, Time.deltaTime * rotationSpeed);

And RotateCoinSystemScript would have an Update method that calls this:

     float rotationSpeed = 10;
     transform.RotateAroundLocal(Vector3.forward, Time.deltaTime * rotationSpeed);

Then you add the RotateCoinScript to each coin (so they each have their own individual instance of it), and then the RotateCoinSystemScript to the parent object (what you call the "Over-Object").

You can adjust the rotation speed as you see fit. Note that Vector3.up is short-hand for the y vector, and Vector3.forward is the z vector. These are globally static properties that always return (0,1,0) and (0,0,1) respectively, but their use becomes local to the objects when using transform.RotateAround*Local* (as opposed to just transform.RotateAround).

Comment
Add comment · 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
0

Answer by Narv · Aug 13, 2013 at 11:39 AM

ughhhhhhh....

I assume you're trying to do this in code? Since you haven't said what you're doing to solve the issue. Try making an animation for this and attach the .anim files to the coin "parts".

Comment
Add comment · 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
0

Answer by Joyrider · Aug 13, 2013 at 11:42 AM

Use Transform.RotateAround for the Y (which will make them rotate around an axis in world coordinates (worldaxes don't change if your object moves)

Transform.Rotate for the Z (which will make your object rotate according to its own axes)

Comment
Add comment · 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
0

Answer by lixpoxx · Aug 13, 2013 at 12:48 PM

I have made one script with the variables rotatez and rotatey.

I tryed Transform.RotateAround but the Console shows this: Assets/scripts/rotator.js(10,25): BCE0023: No appropriate version of 'UnityEngine.Transform.RotateAround' for the argument list '(int, float, int, UnityEngine.Space)' was found.

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 Graham-Dunnett ♦♦ · Aug 13, 2013 at 12:49 PM 0
Share

make sure the arguments you pass are all floats, and not ints.

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

19 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

Related Questions

spin only on one axis 1 Answer

How can I get x, y, z spawnpoints from a csv or text file? 1 Answer

How to create a GUI Text when reaching a point 1 Answer

I have a GUI Text that shows the X,Y,Z but im not sure how... I made one but It just kept increasing... any advice? 1 Answer

y and z rotation axis doing the same thing when x is 270 degrees 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