I want to make a bubble object .It must float and collide like bubble.For example… windows vista screensaver, bubbles float and collide at the corner of the screens .
I tried bouncy material ,lowered gravity but still cant get tat effect.
Basically i want the bubble should float randomly here and there . And bounce back when collides with screen end.
2D or 3D? If 3D, do you want them to move on the ‘z’ axis? Here is one solution.
- Add a box collider to each edge of the screen.
- Create some spheres of different sizes.
- Add a Rigidbody to the spheres
- Turn off Gravity in the Rigidbody
- Freeze the ‘z’ position
- Add the following script to each of the spheres.
Hit play:
#pragma strict
function Start () {
Nudge();
}
function Nudge() {
while (true) {
rigidbody.AddForce(Random.insideUnitSphere * 10.0);
yield WaitForSeconds(Random.Range(0.5, 2.5));
}
}