I am making a simple breakout game. I have added bounce physics to the ball and to the bricks. When the ball collides with the bricks, the speed of ball slows down. I want ball to maintain its speed to what I set it to intially.
1 Answer
\$\begingroup\$
\$\endgroup\$
1
Set a new Physics Material on both the ball and the object you are colliding with. Make sure you set the Friction parameters to 0 and Bounciness to 1.
(Alternatively, you can apply the material to just one side of the collision, with the Combine parameters set to "Maximum" so it overrides the material of anything it collides with)
-
\$\begingroup\$ Done already. Speed is still changing. \$\endgroup\$ Commented Jun 4, 2016 at 12:23
ball.velocity = ball.velocity.normalized * speed
suffices. \$\endgroup\$