• 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 acpirate · Oct 13, 2013 at 04:56 PM · physicsbounce

how to entirely prevent bounce

I would like to create a high (50-100+) cube tower that the player can knock down. The tower is made of 1x1x1 cubes resting on a 1000x,1y,1000z flattened cube object positioned at 0,0,0 that has a collider and no rigidbody. The cubes have a physics material that is set as follows:

dynamic: 1 static: infinity bounciness: 0 friction combine: maximum bounce combine: minimum and other settings at default

The only physics setting I modified is to set bounce threshold to 1000.

A script spawns a stack of cubes at a height offset equal to .99 they should spawn exactly stacked counting penetration.


With this configuration any stack larger than around 12 never rests and eventually vibrates off of itself.

To confirm excess bounce was the issue I froze all rotation and froze x and z position.

With the frozen properties stacks of as high as 50 (maybe more) eventually come to rest. After the scene starts you can see the stack move up and down in the y direction even though it shouldn't, and you can also see a couple of cubes at the top "pop" when they first spawn.

The final resting Y position of the bottom cube is 0.9789241 (varies slightly).


My question is what settings can I use to instantly have my tower a "natural" position when the scene first starts and ready for player interaction?

Comment
Add comment · Show 8
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 meat5000 ♦ · Oct 13, 2013 at 05:10 PM 0
Share

I think the only way this can be done is by making the rigidbodies sleep. $$anonymous$$any people including myself had the same issue and it's not resolved.

avatar image acpirate · Oct 13, 2013 at 05:15 PM 0
Share

I can explicitly call sleep in start but the problem is this leaves the tower in an "unnatural" state. When any part is interacted with it will fall and if the bottom activated the top will remain floating in the air since it isn't touching the lower pieces.

avatar image meat5000 ♦ · Oct 13, 2013 at 05:21 PM 0
Share

$$anonymous$$any QAs of people complaining of rigidbodies that continue to slide and bounce even at rest. One suggestion is making rigidbody.velocity equal zero in OnCollisionStay()

$$anonymous$$any people solve by Hack rather than actually fixing the root problem.

A script spawns a stack of cubes at a height offset equal to .99 they should spawn exactly stacked counting penetration

I think if the colliders are intersecting at all the rigidbodies try to force the objects 'out of' each other. Even on a tiny scale this can cause migration.

avatar image acpirate · Oct 13, 2013 at 06:18 PM 0
Share

I get the same result if I increase the offset to greater than the height of the cubes. I froze all of the movement except for y position to try to isolate the issue as much as possible. Even with 0 bounce and maximum friction I still get bounce after contact.

avatar image robertbu · Oct 14, 2013 at 02:22 AM 0
Share

I just did a test run using Sleep(), and I was not able to get the rest of the blocks to hang in the air. Note I stacked them at 1.0 intervals and had $$anonymous$$in Penalty for Penetration set to 0.0. I was able to knock them down both by using the DragRigidbody script and by pushing a ball into the lowest block.

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by uanmanarmy · Jul 31, 2014 at 10:31 AM

pragma strict

function FixedUpdate() { var currentVelocity = rigidbody.velocity;

     if (currentVelocity.y <= 0f) 
         return;
      
     currentVelocity.y = 0f;
      
     rigidbody.velocity = currentVelocity;

}

attach this script to the objects

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

17 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 avatar image avatar image avatar image avatar image

Related Questions

Bouncing Ball and Walls 1 Answer

Cant find options to change physic material to bouncy 2 Answers

RIGIDBODY HOW MAKE IT STOP BOUNCING HELP! 3 Answers

Changing physics properties of a gameobject through code. 1 Answer

Realistic Bouncing Effect 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