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 Frankdt1234 · Jun 06, 2015 at 10:41 AM · rigidbodyaddforcerotatearoundcurveaddtorque

How to move a rigidbody along a curve or spiral

I'm trying to get a rigidbody to spin in a spiral or a curve much like this: alt text

The game is in 3d but this is just a 2d representation. The arrow in the circle represents the way the rigidbody is facing.

I've tried many things and got fairly close.

RotateAround seemed to be a good solution. The problem was that this force needs to be relative to the rigidbody's position and rotation. When using RotateAround, the rigidbody always circled around the same point regardless of rotation.

AddTorque was strange. It seemed like the rigidbody couldn't rotate in two directions at once. I added torque to the Y axis and then added force to the rigidbody. It rotated just fine on the Y axis, but the x and or z axis did nothing when the rigidbody started moving forward. I feel like the ball should have done something similar to the picture but it just went in a straight line and rotated on the Y axis at the same time. The rigidbody rotates forward normally without that specific torque added to it strangely enough.

AddForce was another close one for me. I used AddRelativeForce to a point to the right of it every FixedUpdate which did some strange things. The ball would sometimes bounce even though all force was on the x and y axes and it took place on 1 level plane added to the scene. It also didn't follow a smooth path most of the time. Depending on the destination of this point and the amount of force I had pulling it, it would usually go in a jagged curve, bounce, and most of the time pick up speed and fly away into the distance even though that point was only a few units to the right of the rigidbody.

Here's one of the lines of code I tried to get this working:

 rigidBody.AddRelativeForce ((transform.right + new Vector3 (distance1, 0, distance2)) * spinMultiplyer * force);

 force -= forceMinus;


In this particular example, I tried reducing force by "forceMinus" which was very small, usually .002 to .006. I also tried keeping force constant and having forceMinus = 0. I also made all the variables public so I could change them in game to try and find a good result, but after hours and hours of trying, I've decided that I probably need help. I've looked at many different questions about a similar topic and tried the solutions provided, but none seemed to satisfy my problem.

forceexample.png (35.1 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

0 Replies

· Add your reply
  • Sort: 

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

2 People are following this question.

avatar image avatar image

Related Questions

How to have a cube to fall on fixed rotation? 1 Answer

Moving a ball through add force and rotate around 1 Answer

Rigidbody.AddTorque/AddForce Question. 1 Answer

Top Down car/vehicle movement 1 Answer

How to make a ball capable of rolling around a loop the loop? 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