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 sbro · Apr 12, 2013 at 05:11 AM · physicsrigidbodyloop

Push Rigidbody ball around a loop de loop?

I'm trying to get a rigidbody ball character to go around a roller coaster styled loop using only physics. I've tried the downforce method with -transform.up gravity mass but the character simply stops when the loop becomes too steep (around 90 degrees). I've got collision data via a downwards raycast and visual debugging shows the ray aligning to the normal of the loop, I'm wondering what would be the best way to use this data to apply the appropriate force. I've also tried adding force with the raycast hit - the player position but that yielded the same result. If anyone could help me on this I would greatly appreciate it, I've yet to see anybody achieve this without a spline path.

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 Owen-Reynolds · Apr 12, 2013 at 04:55 PM 0
Share

How do you find the current "down"? In other words, how do you know which direction to raycast to get the loop normal? The ball's local down, is just going to spin like mad, pointing wherever.

Seems the trick is to take the center of the loop, $$anonymous$$us your current position (and then the normal of the "real" curved loop is the opposite.)

avatar image sbro · Apr 15, 2013 at 02:25 AM 0
Share

Thanks for your help I got it working!

1 Reply

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

Answer by Loius · Apr 12, 2013 at 05:47 AM

The Vector3.Cross( +/- player.right, surface.normal ) will give you either the ball's forward or backward relative to the slope depending on whether you send + or - player.right. That is, you'll get the direction the ball should be moving at that point in the loop.

If you rotate that direction slightly towards the ramp (away from surface normal), you can apply force along that direction and keep the ball pinned to the surface and moving forward.

Such is the hope, at least. :)

Edit: Oh, and if the ball is spinning wildly and has no consistent .right, you might can use the loop object's .right instead.

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 10001110101 · Apr 20, 2013 at 02:02 AM 0
Share

But how would you rotate that direction vector "slightly"?

avatar image Loius · Apr 20, 2013 at 05:20 AM 0
Share

force = Quaternion.AngleAxis(slightly, right) * forward;

avatar image 10001110101 · Apr 22, 2013 at 05:35 PM 0
Share

Thanks, brother.

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

13 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

Related Questions

Rigidbody bowls/baskets - is there a better way? 0 Answers

Object Flies into Air Upon Collision, or goes through hill depending on isKinematic settings 1 Answer

Invalid AABB Error on collision :( 1 Answer

RigidBody immediately stops after AddForce 1 Answer

How to setup character Collisions? 2 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