Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.22
more ▼

asked May 27 '19 at 06:25 PM in Blueprint Scripting

avatar image

Sergeant Razer
10 1 5

avatar image DonBusso May 27 '19 at 07:25 PM

Welcome! 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.

avatar image Sergeant Razer May 28 '19 at 10:47 PM

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? ^^

avatar image Nebula Games Inc May 28 '19 at 11:05 PM

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.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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".

more ▼

answered May 27 '19 at 08:19 PM

avatar image

Nebula Games Inc
5.4k 28 9 15

avatar image DonBusso May 27 '19 at 08:30 PM

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!

avatar image Nebula Games Inc May 27 '19 at 09:18 PM

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 :)


avatar image DonBusso May 27 '19 at 09:39 PM

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! ;) 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. :)

Back to kicking my box around the level.

avatar image Nebula Games Inc May 28 '19 at 10:59 PM

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 :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question