How to manage Physics2D bounciness so an object does not rotate like crazy after the bounce?

Hello,
I’ve encountered a problem while trying to make my objects bounce off each other.

63596-capture.jpg

When one of my objects of mass 1 hits the brown object of mass 500 the brown objects starts rotating very fast in the highlighted direction. I have tried increasing angularDrag but it only manages the drag it self instead of Angular Force or something similar.

The question is:
Does Unity have a more sophisticated bounce component? Or the only way would be writing a script?

Thanks in advance :slight_smile:

Student of University of Essex,

Laurynas Pupsta

2 Answers

2

there small option in the rigidbody2D component called: Freeze Z Rotation. mark it and wa-la!

also you can make a simple script that freeze the rotation by writing in the FixedUpdate Method: transform.rotation = Quaternion.identity;

That appears to be a lighting issue. Unity uses lower quality settings for lighting in mobile. You can check the [Quality Settings][1] in the editor to see the differences. Then you need to adjust your lighting setup to make it more consistent between the settings. It can be more of an art than a science at times. [1]: http://docs.unity3d.com/Manual/class-QualitySettings.html

Well, TBH I just wrote a script to emulate the hit with forces at the collided point. Then I tweaked the force of the hit to the shape and done. Thanks for the answers tho! Cheers
The code that solved my problem:

void OnCollisionEnter2D(Collision2D collision) {
	    if (collision.gameObject.name == "shape")
	    {
	        Rigidbody2D hitRb = collision.gameObject.GetComponent<Rigidbody2D>();
	        hitRb.AddForceAtPosition(rb.mass*rb.velocity, collision.contacts[0].point);

	        GameObject.Destroy(gameObject);
	    }
	}

Thank you.