- Home /
Elastic collisions between cubes and walls
I have a simple scene with two cubes and walls as shown bellow.
The right ball starts moving with initial instant force along the x-axis and collides with the first ball and reflect off a vertical wall. Each collision in the system is supposed to be absolutely elastic.
I just need to add some initial force to the right ball and everything else will happen by itself
Rigidbody2D rb;
void Start()
{
rb = GetComponent<Rigidbody2D>();
rb.AddForce(new Vector2(-1,0), ForceMode2D.Impulse);
}
I also add Rigidbody2D and Physics material on walls and cubes with Friction 0, Bounciness 1 and Gravity Scale 0.
But there is no bounce in the scene
What happens ins$$anonymous$$d of the bounce then, can you please describe? It just gets stuck on the wall?
try playing with the mass and other rigidbody components.
Your answer
![](https://koobas.hobune.stream/wayback/20220612222722im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Linecast Detecting Initial Collision Correctly, Need it to Stay Until Line Doesn't Intersect 1 Answer
tags on ContactFilter2D? 0 Answers
How do I predict an objects position that might collide with something?? 0 Answers
How to optimize a lot of colliders? 1 Answer
OnCollisionExit2D gets called when kinematic is turned on, is that right? 2 Answers