Make object hover/bounce in mid air using Blueprints

Hi all

I am trying to figure out how to make an object ‘hover’ in mid air. I found a useful hover tutorial, but the component in the tutorial requires a floor/base underneath the object: Adding a Hover Component | Live Training | Unreal Engine - YouTube

I am trying to make an object hover in mid-air without requiring a base underneath. To clarify what I mean by hover, I mean a simple animation where the object bounces up and down in mid air.

I’m guessing it’s quite simple and that it essentially involves coding a start value and an end value on a Z axis on an Actor’s location, and making it loop, but I’m quite new to Unreal and I’m not sure how to go about this.

Thank you in advance for any help! If any clarification on this question is needed, please let me know.

Cheers
Matt

1 Like

313197-float.gif

6 Likes

Thank you, this is exactly what I was looking for!

I will say, though, that I modified my blueprints, which are applied in my EventGraph of my object. You will notice that I’ve used GetWorldLocation rather than GetActorLocation. I’m curious how you created your blueprints as Components seem to not allow Timelines?

1 Like

I did this in the level BP, but you can also use timeline inside a BP ( but not in a function ).

To clarify what I mean by hover, I
mean a simple animation where the
object bounces up and down in mid air.

Do you want to make a physics-driven component out of this so you can reuse it with other physics bodies?

If all you want is an actor bobbing about, ClockworkOcean’s approach is the way to go.

Hey, I just wanted an actor bobbing about so ClockworkOcean’s approach was perfect - thanks for clarifying!

Cool. Hey, I’ve noticed that if I move an Actor up and down on the Z axis in the level editor, this blueprint will make the Actor reset its original position on the Z axis. I’m guessing I need to make the Lerp values relative to the Actor’s current WorldLocation, but I’m getting no luck messing around with ‘float - float’ nodes, etc.

Do you know how to edit the Blueprint so that I can move the Actor up and down on the Z axis in the level editor to change its default Z axis position for the hover?

Cheers
Matt

Like this:

PS: If you tick the answer, it gets marked as ansered :wink:

2 Likes

If they’re the same actor, then of course you can just put more than one in the level and instance them that way.

If they are conceptually seperate items, but need to share the floating functionality, then make an actor blueprint which knows how to float ( can be parameterized ), and then inherit from this to make the child blueprints.

( right click on the BP in the content browser, and choose ‘create child blueprint class’ )

EDIT: If you’re just making different meshes float ( for example ), no need to use inheritance there, you can just make the mesh a parameter.

Exactly what I needed and you have saved me a heap of time.

Thanks for the help on this one - much appreciated!

Cheers Matt

Thanks for that! Again, this blueprint is super useful and is exactly what I was looking for. I have ticked this question as answered - thanks for pointing that out.

Hopefully this is my final question on this topic: I have multiple Actor blueprints, and I want to apply the same hover effect with the same variables that I have made to each individual Actor blueprint. I was wondering if something like making a component is possible, so that I can place the component into each Actor blueprint? Or is it easiest/quickest to simply duplicate the hover effect code into each Actor blueprint?

Please let me know if any clarification is needed on this question.

Cheers
Matt

You’re welcome Matt.

Any chance of re-creating this answer? After the AnswerHub migration, all image links are now not working.

hey, so i did the same thing, but when i hit play, it disappears but i can tell it’s running cuz i clicked on it before play, and i could see the values on the z axis changing