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"

Character Movement

Hi, would be cool if I could get some help with the basics of implementing a standard character movement system.

What I don't understand is:

  • there are several bool-variables and functions related to jumping and crouching... which ones should I use, and in what order?

  • how should I deal with different speeds (run, walk, sprint)? Inside the movement component, under "Walk", there is only a value for walk speed and one for crouch speed.

Product Version: UE 4.10
Tags:
more ▼

asked Jan 27 '16 at 09:45 PM in Using UE4

avatar image

MaxPower42
653 68 83 118

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

3 answers: sort voted first

1) The order should not matter, but depends on what you want to achieve. Also note that it's an example project. There are several ways to implement the stuff shown in the ThirdPerson Example project (which i assume you refer to).

2) Walkspeed is found under the CharacterMovement component. And in case you want your character to run you set the variable "Max Walk Speed" to a suitable running speed (like 600 or something) and in case you want your character to walk, set it to something like (200). This should however be matched up with whatever you setup inside your blendspace for movement. Hope that helps you out.

more ▼

answered Jan 28 '16 at 09:24 AM

avatar image

Jonas_Molgaard
496 30 25 48

avatar image MaxPower42 Jan 28 '16 at 12:05 PM

1) Well, I am not actually referring to any particular example. I just want to avoid re-inventing the wheel when it's already implemented... And it seems to me there is already a fully functional "jumping- & crouching logic" there, I just haven't found an explanation what values to set and what functions to call. There are so many... Just to name some from "Character": bPressedJump, CanJump(), CheckJumpInput(), ClearJumpInput(), IsJumping(), Jump(), OnJumped()... and then there are more inside the movement component (wantsToJump, DoJump() ...) - and with crouching it is the same.

2) Actually, this is how I'm doing it right now. But I thought it was more of a workaround, not a clean solution... The anim blueprint is already using character speed for blending. So, I don't have to worry about writing custom movement modes or anything then?

avatar image MaxPower42 Jan 28 '16 at 01:30 PM

I should probably ask more precisely...

I guess the way it's meant to be done (and please correct me if I'm wrong) is to call Character::Jump() on pressing the jump-key and StopJumping() when the jump-key gets released. And for crouching: call Character::Crouch() on pressing the crouch-key and UnCrouch() on releasing it.

I did this and now I want to get the character's jumping/crouching status when updating my Animation-Instance (or Blueprint), set the corresponding bool variables and have the state machine start the jumping/crouching state, so the correct animation gets played.

I am calling Character::IsJumping() (or IsJumpProvidingForce()) and checking Character::bIsCrouched for this, but it seems both values stay false, even though jumping adds a force to the character...

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

Yes correct with the jump logic. Check the isfalling status.

About 2) its the way i would do it

more ▼

answered Jan 28 '16 at 01:40 PM

avatar image

Jonas_Molgaard
496 30 25 48

avatar image MaxPower42 Jan 28 '16 at 06:13 PM

Hi again. I think I've got the crouching part right now, but I'm not sure how to use IsFalling() to trigger a jump animation. IsJumpProvidingForce() probably isn't going to work (always false), unless I use a JumpKeyMaxHoldTime greater zero. But I don't think I want to do that. So, what else could I use to distinguish between jumping and falling? I mean I wouldn't want to trigger a jump animation when a character walks off an edge.

Of course, I could bind playing the animation directly to the input-event. But that would just be another (potentially flawed) workaround, would require a lot of "checks" to verify that the jump is actually going to happen, and more replicated network variables or function calls.

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

ah, you are making this networked... i didn't know.

In any case, you should be able to use Jump(). I haven't personally tried to use the other two you mention. When you walk off a ledge, IsFalling() is gonna be true. If you need to have a separate animation for when you trigger a jump by a control-action, then you should set a corresponding bool that the animation graph can use to determine which animation to play.

more ▼

answered Jan 28 '16 at 08:23 PM

avatar image

Jonas_Molgaard
496 30 25 48

(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