x

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

Product Version: UE 4.16
Tags:
more ▼

asked Dec 11 '17 at 12:25 PM in Blueprint Scripting

avatar image

David.Borrego
10 4 4 10

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

3 answers: sort voted first

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

more ▼

answered Dec 15 '17 at 09:47 AM

avatar image

Ego Studio
606 4 4 5

avatar image David.Borrego Dec 15 '17 at 02:43 PM

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.

avatar image Ego Studio Dec 15 '17 at 03:16 PM

alt text

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

pawn.png (95.5 kB)
avatar image David.Borrego Dec 15 '17 at 04:38 PM

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

avatar image Ego Studio Dec 15 '17 at 05:01 PM

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.

avatar image David.Borrego Dec 15 '17 at 09:04 PM

Thanks you a lot. It seems that works perfectly.

avatar image Ego Studio Dec 16 '17 at 09:05 AM

Glad to help.

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

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.

more ▼

answered Dec 11 '17 at 01:16 PM

avatar image

Ninjin
4.1k 88 38 151

avatar image David.Borrego Dec 11 '17 at 02:49 PM

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?

avatar image Ninjin Dec 11 '17 at 08:44 PM

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

avatar image David.Borrego Dec 11 '17 at 08:50 PM

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

avatar image Ninjin Dec 12 '17 at 02:25 AM

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.

avatar image David.Borrego Dec 12 '17 at 08:10 AM

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. alt text

And this is the timeline alt text

capture.png (141.1 kB)
capture2.png (38.5 kB)
avatar image Ninjin Dec 12 '17 at 01:13 PM

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.

avatar image David.Borrego Dec 12 '17 at 02:22 PM

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

Thankss, for all.

alt text

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

captura2.png (67.8 kB)
avatar image Ninjin Dec 12 '17 at 05:30 PM

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

avatar image David.Borrego Dec 12 '17 at 05:44 PM

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.

avatar image David.Borrego Dec 14 '17 at 05:20 PM

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

avatar image Ninjin Dec 15 '17 at 04:22 AM

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

avatar image David.Borrego Dec 15 '17 at 02:47 PM

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.

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

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.

more ▼

answered Dec 15 '17 at 08:07 AM

avatar image

cmarston74
296 6 7 10

(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