I have a scene where I want to have a bouncy ball that will bounce around the screen forever.
I have created a sprite and added a ridgidbody2d (no gravity or friction; mass = 1;) and circle collider2d with a bouncy material (friction = 0; bouncy = 1;). I have also got box colliders on each of the 4 sides of the viewable screen. I have added a script to AddForce() on Awake to the ball. However it is hitting a wall and then sliding along it instead of bouncing away.
I am wondering why there is no Bounce Threshold for the 2D physics?
Does anyone know what I am doing wrong here?
I have found out that I can get my ball to bounce but only when it has a big enough magnitude. This I can only assume is because there is no setting to reduce the Bounce Threshold like there is for 3d physics. Does anyone have any idea about this or know a way that it can be changed so I can always make my ball bounce?
Make sure there is Physic material on both objects. You can try 'Multiply' bounce mode for best effect. Reduce drag on the ball and make Mass really small. Admittedly, I haven't played with the 2D toolset yet, so this is info from 3D which may or may not apply.
I have already set a bouncy physics material and reduced all drag. However with the new 2d physics there does not seem to be a project setting to set a Bounce Threshold, and the 3d physics settings do not affect anything in the 2d physics toolset.
On 2d Physics bounce threshold is 1.0. it is fixed. that means if your velocity < 1 it will not bounce. change your graphical scale to see the same visual speed but higher real speed on engine.
I was afraid that this was my only solution. I was hoping to keep my NGUI camera and main game Camera the same scale so as not to have to set fonts sizes of over 60 to be able to see the text. At a bigger screen scale and a larger force to compensate for the difference in perceived speed this does now work. Still wish Unity had a configurable bounce threshold like it does for the 3D physics.
Does that not effectivley change the visible size of all the sprites? If this is a different setting to what I am thinking of then where do I find this setting and which way should I modify it? Up or down? I am guessing down to make the meters smaller and thus will increase the ball velocity to what I need?
assume that you have a pool table and you use 100px x 60px background image. if you pixel per meter is 100 it means your pool table size is 1 m x 0.6 m. if you set pixel per meter as 50 then pool table size is 2m x 1.2m. if it is bigger, to see the same movement you must increase ball speed. you can find pixel per meter in unity sprite import settings. http://docs.unity3d.com/Documentation/Components/class-Texture2D.html (sorry after i checked this page i noticed i confused the name: it is "pixels to unit". pixels per meter is in 2d toolkit.
That is what I thought. This would also require me to change the camera size so the objects still get rendered at the same visual size they are now (E.g. doubling the meters means I should half the screen size to make the displayed sizes look the same?).
I have found out that I can get my ball to bounce but only when it has a big enough magnitude. This I can only assume is because there is no setting to reduce the Bounce Threshold like there is for 3d physics. Does anyone have any idea about this or know a way that it can be changed so I can always make my ball bounce?
– izzycodingMake sure there is Physic material on both objects. You can try 'Multiply' bounce mode for best effect. Reduce drag on the ball and make Mass really small. Admittedly, I haven't played with the 2D toolset yet, so this is info from 3D which may or may not apply.
– meat5000I have already set a bouncy physics material and reduced all drag. However with the new 2d physics there does not seem to be a project setting to set a Bounce Threshold, and the 3d physics settings do not affect anything in the 2d physics toolset.
– izzycoding