How can I jump with a Pawn

I want to make a jump with a pawn, but the differents forms that I’have tried haven’t worked. I won’t use physics.
What is the best form to do this??

How about a Timeline with your jump Z height as parameter. Then you just make a curve from 0 to your jump height and back to 0. This would be great if you have a simple plane setup.

Thanks it works, But i have another problem. I have some pawns with the same blueprint of jump. In the Game mode i have a function for jumping, and all the pawns have a cast to the game mode and take the jumping Function. The problem is that Game Mode Blueprint do not allow Timelines. So is there another form to do this or do I have to program this jump one by one?

Do you want your pawns to jump at the same time? If so, just make an array of them in your gamemode and add a timeline (try to check again, Timelines in a GameModeBlueprint are possible).

I don’t want to all my pawns jump at the same. I only put my blueprint of jump in GameMode for not programing the same in all the pawns.

I get add a timeline in the GameMode(I couldn’t add this because i was using a function), but each time I press the play button, the pawn jump with difference strength i don’t know why.

So, apart from timeline, do you know any other form por make a pawn jumping??

Can you share your blueprints? This has to work with a timeline and I’m pretty sure there just a tiny mistake somewhere. Since you can literally see your jump behavior in a curve, this is the best approach for a non-physics jump.

There is the jump blueprint in the game mode. “Saltar” is a custom event that calls from every pawn and pass the pawn jump force and the mesh.

And this is the timeline

You are setting your world location and in the next frame you take this value with GetWorldLocation and add the timeline’s z value to it. Don’t take the z value of your GetWorldLocation and just set the world location’s z value to the value of the timeline. You could even make a float variable in your timeline and just change the z value directly. But don’t add the current value to it and everything should work as expected.

I didn’t understand you very well. Did you say so? If not, could you share and example??

Thankss, for all.

I think you method works but only if the pawn is in the Z=0 location. I want to jump in every z position.

Any chance you can describe more about your game? Is it 2D or 3D, what is your camera, why exactly you are not using physics etc. Are you only moving on a plane or is your ground height different?

You can offset the curve depending where you put your plane, but the whole time I was thinking about a mobile 2D game, so if you describe your game, that would be great, because I can think of 10 different implementations depending on what your game is about <3

It’s a 3D game for PC with differents ground heights with a 3rd person camera. I use a pawn instead of a character because my player is an animal and the capsule collider of character blueprint it’s not appropiate. I tried to use physics, but it’s difficult to control for me it and I prefer not to use it.

Sorry for no specify this before.

Any other solution?? even if it is using physics??

Why is the capsule collider not appropiate? You can just use the same height/width and make it a sphere and just use the built in character movement component. Not exactly sure what animal you are doing and if you want realistic movement, but with gravity scale and jump height you have everything you need. Try again and be more specific, because I don’t see the issue <3

Add Impulse / Add Impulse At Location might be another solution, but the mesh should simulate physics.

To make your character jump, you will need to add your timeline data to a base height at the start of th jump. When you start your jump, set a variable in your character blueprint to its current z value at the start of the jump. During update add this base height value to your timeline z and leave x and y as original from your GetWorldLocation. This will add the timeline to the starting height each pass and give you the intended jump behavior. The only issue is if your jump to a lower level. This setup expects you to land at the same height you started from. This is why this technique is not normally used for jumping.

A better solution would mimic gravity by accelerating your character upward at a certain velocity in z and for each tick apply a drag factor that will slow the ascent and eventually make the character fall until it hits ground again.

I tried to use physics and use Add Impulse / Add Impulse At Location but the problem is that i only want to use physics when my player jumps. I tried to put a trigger in their feet, to activate and deactivate physics, but when physics is enable the trigger works as a collider instead of a trigger.

A Sphere collider is not appropiate for my character because it not cover all the model. There are zones that wouldn’t have collider and it’s important that all the mesh have a collider.

I’ve found a trick to do it. Add a projectile movement. The picture show you the basic stuff but you probably want to add a direction to the jump (adding actor offset according to the forward vector for example).

1 Like

I tried this, it works fine at first, but when I jump and hit a wall it seems like the projectileMovement deactivate and I stay floating in the air.

In the other hand, I fix the solution of the physics. My pawn jumps perfectly but he fall down very slowly. Is there any way to fall down faster?

What of the two ways do you think it’s better??

Thanks in advance

For the projectile movement, setting “Should Bounce” to true may resolve the problem of stuck on wall (use slight values on Bouncing options as your pawn will bounce far away). And for falling speed, increase Gravity Scale so the pawn would fall faster. I can’t really tell which of them is better…probably the one which has the less issue depending on your project.