How to make an object floating around

Hello UE4 Community,

I’m wondering if there is an option (maybe Blueprints) how to make an object automatically and randomly floating around in a certain radius (without player interaction).
Is there any “simple” solution?

You can play around with physics settings for your object. As an example you can drag in a basic cube into the world and select it. In details panel for you object look for Simulate Physics and Enable Gravity. You want to tick the first one and leave the Gravity unchecked. Start the game and run into the cube.

You can also play around with MassInKg with Gravity enabled. Another things you could check are Linear and Angular Damping.

What the above comment said…or you can add “projectile movement” component to any object and then do as the above stated. Select the projectile movement component, on the right hand detail panel look for an option to set gravity scale (default is 1) make it 0 and your projectile will move forward with no effect of gravity. You of course need to set its initial velocity for it to move (the default is 1,0,0) so 1 unit in the forward direction of the component. You can mess around with the physics settings as well. So overall, the answer is yes! There are many easy ways to get something to “float”.

Things I learn just reading this section…amazing. I will need to study projectile movement closly.
I have just spent like 15 minutes kicking cube around my level or watch it fly away into abyss.Great fun and helps you relax when you hit a wall or your cast fails (lol).
What I have learned playing around with UE4 is that there is no such thing as impossible, you just need to find a way to do it!

1 Like

Very true, very true. If you are just getting started I created a beginner friendly tutorial series that goes over a lot of the basic concepts of blueprints and how to create game play logic. The link is below, it might help your learning process :slight_smile:

Already watched a few videos, very informative! Thank you!
Every time I see You or Everynone reply in a question I immediately click on it a read all the comments! :wink:
However right now I’m going over another tutorial series regarding drag and drop inventory, but what I have learned from it so far will be a good base to build my future inventory/equipment similar to diablo style inventory.
Getting into basic modeling and material creation too so it’s all good fun. :slight_smile:

Back to kicking my box around the level.

Yes I’ve tried all this before. But what I am looking for is an automatically generated floating for an object. Let’s say I want an object to automatically float around (randomly) within a certain radius when I start the level. So there is no interaction for this object needed. You know what I mean? ^^

I hope not ALL the comments…not all of my ideas are bright ones haha I can’t speak for Everynone though, his/her ideas might all be wonderful I haven’t checked them all out personally but what I have seen has been on point :slight_smile:

Umm, “automatically” doesn’t happen in coding. Unreal does give you a lot of functionality (I guess you could classify that as “automatically”…although someone had to spend time coding it) right out of the box but a free floating/random roaming object isn’t one of them. The best you can do without much effort on your part to code a system for this is to create a bounding box, a floating pawn, and a function that selects a random point within the bounding box and uses the “move to” node to get there along with a nav mesh. And as I write this out I realize that will probably not work because flying pawns + nav mesh don’t play nice together. You could fake it by having your pawn basically have an invisible contact with the ground at all times. Some collision volume or just have the mesh high above the scene component for this actor. Point being, very little is “automatic” for anything that doesn’t touch the ground. UE4 was built for first person shooters so that is where all the “automatic” stuff happens.