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 Mattias-Wargren · Jan 12, 2011 at 07:58 PM · rigidbodygravitycylinder

Cylinders running downhill. Gravity is not enough.

I have a curved ground (model) in my scene working as a hill race track. I have added several cylinders and applied rigid bodies to make them move (roll) down the track. What is the best way to get the cylinders to move the way I want them to move? As it is right now, the cylinders are moving to slow. I want them to speed up when moving down the hill. How can I achieve this?

My solution right now:

function Start()
{
    rigidbody.AddTorque(0, 0, 200 * direction);
}

alt text

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

3 Replies

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

Answer by Goody! · Jan 12, 2011 at 08:26 PM

I like rockets! (ConstantForce) Woosh! Just make sure to angle them correctly so as to not shoot your barrels off into space. :)

Link --> ConstantForce

Comment
Add comment · Show 7 · 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 Jesse Anders · Jan 12, 2011 at 08:34 PM 0
Share

That seems more like a workaround than a solution (and in any case, it doesn't really correlate with the behavior the OP described).

avatar image Mattias-Wargren · Jan 12, 2011 at 08:37 PM 0
Share

This might work well. I used rigidbody.AddTorque(0, 0, 100 * direction); in the Start function but your solution is even better.

avatar image Mattias-Wargren · Jan 12, 2011 at 08:38 PM 0
Share

@Jesse Anders Could you please explain?

avatar image Jesse Anders · Jan 12, 2011 at 08:47 PM 0
Share

The impression I got was that you wanted the cylinders to roll down the hill due to gravity in a realistic fashion, in which case applying a linear force (or even a torque) would be a bit of a workaround. But, if it looks right to you and gives you the results you're after, that's probably all that matters.

avatar image Goody! · Jan 12, 2011 at 08:49 PM 0
Share

Constant forces are pretty easy to do if you want to try it out to see if it does what you want. Select your barrel in the Scene View then all a constant force to it via Component/Physics/ConstantForce. Then just fiddle with the variables to see if it'll do what you want. Have fun. :)

Show more comments
avatar image
1

Answer by Eric5h5 · Jan 12, 2011 at 08:16 PM

Aside from scale, one cause of too-slow rolling is not having a high enough max angular velocity in the physics settings.

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 Mattias-Wargren · Jan 12, 2011 at 08:41 PM 0
Share

What is a good value for max angualr velocity and what are the consequences of altering the value?

avatar image Eric5h5 · Jan 12, 2011 at 09:12 PM 0
Share

http://unity3d.com/support/documentation/Components/class-Physics$$anonymous$$anager.html

avatar image Goody! · Jan 15, 2011 at 11:39 PM 0
Share

Just try things out. Save your project under a different name if you are worried about messing it up, and try things. $$anonymous$$ake a new barrel with super low angular velocity and see what happens, attach a constant velocity to another and see what happens, hell, set off an explosion next to one and see if it does what you want. $$anonymous$$ost of the stuff mentioned in the answers don't have anything to do with scripting and are pretty much, plug, play, and experiment. :)

avatar image
0

Answer by Jesse Anders · Jan 12, 2011 at 08:11 PM

This may be too obvious, but have you tried playing around with different physics materials? (Also, make sure the masses of your objects are in proportion to the scale of the scene and your gravity settings.)

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

No one has followed this question yet.

Related Questions

How to program gravity around a cylinder? (Vine growing up a tree) 1 Answer

Modifying Gravity for Local Player 1 Answer

Rigidbody2D Grounded 4 Answers

Check if Rigidbody collider is grounded 3 Answers

Check if entire box collider has air below, instead of just a point on the box? 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