Download

Trying to get my pawn to hover

Hey guys. I’m trying to get my pawn to hover a bit above ground in a smooth manner. I was following this tutorial: https://www.youtube.com/watch?v=5kltaGld6fQ but following those steps do not produce the same result as in the video. The picture I have attached shows my hover component blueprint. With the way it is, isn’t it supposed to make my pawn rapidly oscillate up and down above the ground? Instead my pawn either slowly moves down or up depending on its starting position (moves up when starting from ground or slightly above ground and moves down when starting from mid-air above the ground) and stays there (no oscillation). What is going on?

PS. I’m running version 4.10.4 if that helps

There are few things done differently on your blueprint than on that tutorial. Tutorial expects you to attach that code as a component but I think you try to build that on the actor itself? Anyway you cache the PrimitiveComponent there which is good but then you forgot to wire it in to two GetWorldLocation-nodes. Now those two nodes actually gets actors world position instead of position of your floating component. This isn’t issue if your floating component is the actor root, but if it’s not, it gets simulated using a separate transform and you need to read it’s world position values directly, hence needing to add your true target to GetWorldLocations.

You also use Add Force at Location on your graph which should work the same as the AddForce on that tutorial in this case (assuming you have center of mass in the middle of your primitive component). If you use AddForce instead, you don’t have to worry about world location itself, you just need to multiply the force with world space direction vector. I still think your issue is for not setting those targets for world location getters. You mainly want to use AddForceAtLocation for forces that aren’t in the middle of the object/it’s center of mass.

Also one more thing to look out for is that you actually have enough force for it to move quickly. Amount of force is different if your object weighs more. You need to find the proper force amount either manually or by adding primitive components mass into your equation.

edit-> also double check that your primitive component has gravity enabled.

Thank you man! I attached the primitivecomponent nodes to the getworldlocation nodes and while it didn’t work initially, I removed all the hover components from my pawn (I had more than one attached at different points) and put them back, causing it to work as intended. However now I have another problem. I can’t seem to get multiple hover components to work on my pawn. I’ve tried adding 4 of them at different points but I’m only seeing the line trace from one of them when I simulate. Also, the one that I’m seeing is not in the position that I moved it to but rather is in the centre of the object.

I’m now assuming that you have an actor or pawn with multiple scene components that you want to use as thrusters.

In that case you now always trace from the primitive components world location and not from your scene components location. To fix this, then just remove those primivite component nodes from get world location (so it uses your scene components location), I mean from all of them and then just apply the add force at location using primitive component as target (but still use location from your scene component itself).