1/16/2024 0 Comments Bounce when touch collision unity![]() Note: This code is inside a custom class (inherits MonoBehavior) I made for the ball object to manage the physics actions.įor additional information, refer to this video to see how the game responds. Here is some of the initialization code that runs when the game loads to start the movement of the ball: float x = Random.value < 0.5f ? -0.75f : 0.75f įloat y = Random.value < 0.5f ? Random.Range(-0.75f, -0.5f) : Random.Range(0.5f, 0.75f) ![]() Material: Bouncy (name of my physics material).Here are some of my current settings (if that helps): I have applied a Rigidbody2D component, BoxCollider2D, and a Physics Material 2D that is supposed to make the ball bouncy. Note that I have already tried to change the bounce threshold in Project Settings, but it does not do anything to solve my issue. My main issue is that a ball in my Unity 2D game doesn't bounce correctly when the speed is set to a lower value but works fine at faster velocities. I have already seen this question asked here, but this applies to Unity 3D, whereas I am working in Unity 2D.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |