Balloon float upwards mechanic.

Hi, wanna know how to make a balloon go JUST upwards for my game. And when it touches the ceiling the game’s over

Add a Rigidbody to the balloon game object and turn off gravity.
In a script attached to the balloon. Add …

public float floatStrength = 3.5f; // change to your liking 

Then in FixedUpdate, Add …

GetComponent<Rigidbody>().AddForce(Vector3.up * floatStrength);

I would name the object, “balloon” perhaps and put a collider on the ceiling that checks the name of the colliding object to end the game.

Hope that helps.

R.

At the beginning of your game, I would use Rigidbody.AddForce() to make it float upward. You can then use OnCollisionEnter to detect collision with the ceiling.

You could also add a Constant Force component to ensure it rises directly upwards.