How to make object float in air?

Hi. I need to make an object float in air. I don’t want it to be still in air. I want to have smooth up and down motion looking like it floats in air. How to do it? Can I do it with tween?

You can do it with a positional tween. Have one for going up, and when it’s finished fire off a going down one (and when that finishes, fire off the going up one and so on). Remember avoid linear easing, use one like EaseInOutSine or EaseInOutQuad instead.

Alternatively, have a instance variable (say called floatingTracker). Then (pseudo code) :
set the y position = original y position + cos(floatingTracker) * maximumHeight
set floatingTracker += 360*TimeDelta()

To slow the last one down, change the 360 to a smaller number

1 Like