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 to add continuous forward motion to my pawn which is a cube?

So I've tried replacing the input axis forward node with the event tick node (in third person side scroller character) and that didn't work. I've tried to plug an add movement input directly into event tick and nothing. I've tried everything I can find. Basically I've got a cube as a static mesh in an actor blueprint class, I want this cube to be what the player will control throughout the game. However, the only thing the player will control is the jump as seen in something like geometry dash or flappy bird, but i can seem to achieve any motion whatsoever with this cube. The images below are the blueprints that didn't work. All in all, all i want is the cube (Pawn blueprint class) to move forward continuously and maybe even speed up but i haven't even thought about doing that. I'm also new to blueprint scripting so sorry if it's really obvious.alt text alt text

Product Version: UE 4.18
Tags:
snip1.png (247.3 kB)
snip2.png (114.0 kB)
snip3.png (375.9 kB)
more ▼

asked Jan 07 '18 at 05:25 AM in Blueprint Scripting

avatar image

Giancarlo_Pad
7 2 2 5

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

1 answer: sort voted first

Hi,

The reason that your cube doesn't move is because you don't have any Movement Component attached to it. If you look at the default Side Scroller Character blueprint, you'll see that it has an inherited Character Movement Component in its Component list. Movement Component is necessary to handle all unique behaviors of your pawn. The nodes such as Add Movement Input are in fact interface functions that work in conjunction with a movement component. They don't have any movement logic themselves! If you know C++, you can code your own Movement Components and create interesting and unique movement behaviors! Take a look at this official tutorial to get started with custom pawn movement.

In case of your cube movement, you can easily accomplish the movement behavior you want by adding a Floating Pawn Movement component to your Pawn blueprint. Just as you would add a mesh or camera to your Pawn, click on the Add Component and search for Floating Pawn Movement. Once added, select it and tune its movement parameters to your liking. To properly use it, you need to call the Add Input Vector node and give it a direction vector. The following picture shows how you would do this for sideways movement along Y axis. For another example of how to using this, see my other post in here.

alt text

Alternatively, you can take advantage of Unreal Engine physics system and move your pawns or static meshes by applying different kinds of forces and torques to your static mesh. Here's a very simple setup that shows how this can be achieved for a static mesh such as your cube:

alt text

Note that in the above scenario, applying this force is similar to giving your mesh a constant acceleration. Its speed keeps increasing as long as the input key is held down. You can also lock rotations of your cube mesh to prevent it from rolling around.

Hope this helps.

more ▼

answered Jan 07 '18 at 08:46 AM

avatar image

Vizgin
1.5k 10 10 17

(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