I know it continues to move upwards because of the initial velocity I wrote. For example, when it hits the right edge of the screen, it just continues to move upwards instead of bouncing off of it. But when it hits the screen edge, it does not rebound back. Here's the problem I'm facing right now: The object spawns and moves as expected. This basically gives the bubble game object a starting velocity when it spawns. ThisBody.velocity = new Vector2(0.5f, 0.5f) In my script, I have: public Rigidbody2D thisBody I also have 4 empty game objects for the left/right/top/bottom screen edge with a Box Collider 2D In the Rigidbody component, I have Gravity Scale set to 0 since gravity is not really involved here I think. I have a game object prefab for the bubble with a Circle Collider 2D and Rigidbody2D and a custom script that I wrote. I am trying to copy the bubble screen saver behavior from Windows in Unity where there are bubbles moving across the screen and bouncing when it collides with the screen edge and/or with each other.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |