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 dansav · Jul 27, 2012 at 08:37 AM · collisionphysicsrigidbody

Stop rigidbodies from bouncing

I have a drag script where I drag one rigidbody up against a kinematic rigidbody to position it. The drag script is really a spring joint that follows the mouse. If I drag the rigidbody near the kinematic rigidbody the rigidbody starts vibrating. I've tried adjusting the physics parameters but haven't found any solution to calm the vibrations. I'd like it to just hit the other object and stop, not vibrate. The object that it's running into is kinematic.

Does anyone have any suggestions?

Thanks,

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 Muuskii · Jul 27, 2012 at 03:49 PM

Your problem is being cause by the fact that your drag script:

Sets position of the object

It's inside a collider so it gets shoved away

But now it's away from where it's being dragged so it snaps back again

etc, etc

A more physically accurate way of doing this (and this is how most games do it) is to make a "gravity point" where you want the object to be and Addforcing the dragged object towards the gravity point. Make sure to use drag when the object is getting close so it doesn't overshoot.

There are other methods of countering overshooting but that's the most basic. This will let you drag objects around and knock stuff over! :3

Extended functionality:

When you Raycast to find the drag point, you can use Rigidbody.AddForceAtPosition to make sure the pivot point is where the player grabbed it. For instance, if you had a teddy bear and the player had his mouse over it's arm when the dragging started; The bear would rotate as if being dragged by the arm.

Note: If you have a Bear made with some InteractiveCloth You might want to attach a collider to make it move even more realistically.

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
3

Answer by Frenchwise · Jun 20, 2015 at 06:09 PM

I encountered a similar problem, which was that when my Player object was hitting a boundary it would fly endlessly away from the kinematic boundary.

A simple fix for me was to add a small amount of 'drag' and 'angular drag' to the rigidbody to stop the infinite movement. You could try setting the drags to 'infinite' also, which would make it stop moving immediately if that's what you're going for.

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 joshuahalls13 · Aug 02, 2020 at 02:20 PM 0
Share

@Frenchwise bro I owe u my life I was trying to figure this out for ages thank you so much!!!! :DDD

avatar image
1

Answer by ScroodgeM · Jul 27, 2012 at 10:05 AM

if both of your objects has colliders, then an object that is not kinematic will be thrown away from the second. it's a physics effect.

if you move an object using mouse, the object should be kinematic rigidbody - that's what for this option is created. once object dropped, make it physics-free rigidbody again.

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

10 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

Related Questions

Help with character controller collision... 2 Answers

physics culling mask? 1 Answer

Do you have to have a rigidbody component for collision detection? 1 Answer

Keep Horizontal Momentum after Jump 2 Answers

Collision.impulse = 0 in OnCollisionStay Kinematic Static collision pair after Update 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