How to use UE4's gravity without it being a playable character?

Meaning you want to use launch character, event on landed, etc etc. But its not a playable character and will never receive an input.

Hey there @usa423! Since those functions specifically are built for pawns, you’d still have to have a pawn to use them. However, since you don’t really need the rest of the pawn features like possession/input etc. You could just have a physics enabled object and use Add Impulse or Add Impulse At Location to launch a physics object, and just handle the collision check for when it lands with On Hit or On ActorBeginOverlap (if more of a trigger) nodes and just check what it hit.

Some of the nodes you could use:

An example of how to check if the actor it lands on/hits has a tag, in this case I’m checking for Ground:

1 Like

Hey there SE, thx for the suggestions! I am using an actor with a cube and the actor has a tag “land”. I am thinking I may just have to end up using a line trace under everything and just have a constant negative Z on objects (add actor world offset?) unless they are hitting “land”. I notice on many old platformers that even energy or dropped items could land on moving platforms and ride along easily.

So you are saying use a pawn, and just add a cube and enable physics on the cube? But it would have to be the root of the pawn wouldn’t it? If not it could still pull everything else down?

Depending on your use case physics may work if your “moving platforms” are physics based (like a boat), then I’d recommend the impulse and hit/overlap checks, and yes the root of the actor would need to be a mesh to handle the physics. Otherwise, you could handle the movement yourself like you mentioned with a downward check, which would give you more control but be more effort to put together.

What’s your full use case?

1 Like

Well, I am just trying to figure out a way to get a similar response for a pawn as a “character” bp has. Similar jump response and floor detection. Because as you know the character movement component is linked to and locked to the capsule component of a character blueprint.

Right now I am recreating the Megaman 1 (NES) Ice Man stage with sprites for learning purposes.

Overall I have it looking and sounding decent. However, even when it is shrunk as mush as possible the capsule basically is an egg shape. This means he can go to an edge of a platform and there is a gradient there. Where the middle of the capsule is over the edge and there is no land under the character hence the “is falling” (or jumping?) pose is triggered when it should not be. Here is an example.

Ahh I understand! I originally misunderstood your intent. In this case, since you’re already using the sprite character class from Paper2D, you still have access to the launch/landed, but you’re not getting the landed event due to being on one of the capsule rounded sides.

There’s a boolean on the character class specifically for this situation. It’s called Use Flat Base for Floor Checks:

Give that option a try and let me know how it goes!

1 Like

That did help some, thanks.

No problem! I forgot to mention the Perch settings as well, which may also mitigate this issue:

1 Like

Hey it all helps. I set both of those to zero.

1 Like