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 Component Doesn't Update

Hello all,

I've been working on making a simple follower for my player character in a 2D platformer I'm making with paper sprites. I created the follower as a child of the Paper Character Class, gave it a CharacterMovement component, and set a timeline and vector lerp to get it to move from its current location to the location of my player character. Now I've moved on to trying to animate the follower, and I've noticed something strange happening with the CharacterMovement functions. They don't seem to update.

I use a function to change the flipbook that the follower uses depending on the value of a boolean called IsMoving. That boolean is determined by the function IsWalking from the CharacterMovement component. So if IsMoving is true, the follower should use its walking flipbook, and if it's false, it should use its sitting flipbook. However, when I test it, the follower doesn't stop walking, even when it's not moving anymore.

In the debug window, I've found that IsWalking actually stays true all the time - it doesn't update to false when the follower stops moving. The same thing happens when I use IsMovingOnGround. I've also tried using a separate method for seeing if the follower is moving - I use GetVelocity to see if it's moving, but that doesn't work either. Again, when debugging, that value is always at 0, regardless of whether or not the follower is moving. You can see the different attempts I've made in my blueprint below.

alt text alt text alt text

So how can I get around this? Is there something about using a timeline to move a character that messes with the CharacterMovement component/GetVelocity? Any help would be greatly appreciated.

Product Version: UE 4.9
Tags:
more ▼

asked Oct 12 '15 at 03:34 AM in Blueprint Scripting

avatar image

Rhiannonnee
18 5 11 15

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

1 answer: sort voted first

I don't know if this is still relevant to you but I think I see the problem, mind you this is just after a cursory glance and after a few drinks. I notice that you aren't moving your component with "Add Movement Input" function. That function in particular you're going to want to use for all pawns that have a designated controller (which most should by default barring any "complex" or extra programming on your part to the contrary).

Add Movement Input takes a direction (specifically a vector type, which for all intents and purposes should be normalized, or not have a length greater than 1. There are prepackaged functions that should be able to accomplish that for you if you drag off from a vector and type "normalize"), a scalar value (basically how fast do you want this to move in the direction provided), and a boolean, "Force" (which forces the input even if it should be ignored). Optionally you can specify a target at the top of the node stack if you are affecting an "alien" pawn, or a pawn other than the one you are currently putting this node in.

If you need an example, this is a bit more complicated, but I have an excerpt from a somewhat basic following enemy. The only thing you'll notice that is not a part of your available functions is my macro DistanceBetweenTwoPoints which is a basic algebraic formula that, as you guessed it, calculates distance between two given 3D points (also works in 2D because math). One last caveat is that I changed my locked plane to a different axis. I think the default is "Y" so you'll need to leave that as a 0 so you don't go plane hopping.

alt text

movement.png (170.5 kB)
more ▼

answered Mar 12 '16 at 04:08 AM

avatar image

Colbinator
38 4 6 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