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 Sam 5 · Jan 25, 2012 at 03:16 AM · rotationparent-child

Spinning Ball on a string problem (slings, trebuchets etc.)

So I have two objects, parent and child. The parent is spinning using transform.rotate. The child rotates around the parent as the parent rotates because thats how their relationship works. I generalize this idea as like that of a ball on a string. you twirl the string in your hand and the ball spins around it.

If I cut the string (ball.transform.parent = null) my knowledge of physics 101 tells me the ball should continue in a straight line tangential to the rotation. When I attempt this in unity the ball sits perfectly still. It just stops the moment I de-parent it. I throw in some variables and watch the inspector and sure enough, both velocity and angular velocity of the ball while it is a child of the string's anchor = (0,0,0). So what gives? how do I find the world velocity of an object rotating around it's parent? If I could find that I could record that each frame and when I de-parent look up the most recent velocity and just keep using that.

Comment
Add comment · Show 1
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 syclamoth · Jan 25, 2012 at 03:18 AM 0
Share

Transform.rotate has nothing to do with physics. Your 'ball on a string' analogy isn't really correct, and thinking about it that way can be misleading. If you want it to use physics, use rigidbodies and joints.

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Berenger · Jan 28, 2012 at 12:03 AM

As syclamoth is saying, you should use the unity physics scripts like joints. But if you really want to use Rotate, then you need to calculate eache frame the vector v = pos - lastPos, so when string breaks, metaphorically speaking, you can use rigidbody.AddForce( v * someVariable ).

PS : syclamoth, why you never answer in the answer area, it leaves misleading unanswered questions ! I'm sure you're doing this on purpose to trap people :p

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 MidgardSerpent · Jan 28, 2012 at 12:25 AM

Reiterating (and hopefully clarifying) what's been said before.

Parenting an object doesn't create a physics connection... it just keeps the two objects in the same relative positions by changing their transforms.

The best way to do this is to make sure both objects have rigid bodies, then use a fixed joint to represent the "string" ...

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

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

7 People are following this question.

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

Related Questions

Why is a child object not rotating properly with parent? 1 Answer

Why do grouped Terrain objects move together but don't rotate as one? 1 Answer

children doesn't take parent's rotation, position or scale. 1 Answer

Having difficulty with Parent Object rotation and Child Object movement. 0 Answers

Relative transforms and parenting 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