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"

Make enemy follow player but only along one axis

Hey guys.

I'm trying to make an enemy always follow my player in a sidescroller but I only want them to follow my character on one axis. When player character jumps the the enemy starts following them on the Z axis as well.

I've been trying to only pin one single axis and it does adjust the movement of the enemy but it starts moving it in a completely different direction.

This is the non restricted working blueprint.

alt text

And this is what I am attempting to do but it messes up enemy's movement direction

alt text

Thanks

Product Version: UE 4.19
Tags:
move.jpg (389.5 kB)
move2.jpg (334.6 kB)
more ▼

asked Jan 20 '19 at 02:04 AM in Blueprint Scripting

avatar image

abulgako
1 1 1

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

2 answers: sort voted first

What you have in your second image seems to ONLY be using Z, it seems you want to plug in x and y and ignore Z.

more ▼

answered Jan 20 '19 at 03:28 AM

avatar image

Rymbrant
66 1 3 6

avatar image abulgako Jan 21 '19 at 04:48 AM

I've tried plugging in both x and y and the enemies start walking away from the character towards the camera at a 45 degree angle

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

I think you may make a new location vector and feed that vector with only the player's axis you want the enemy to follow along .. and add movement input to the enemy towards that location vector. I am sorry I am just an absolute beginner, so please pardon me if I am wrong .. I just wanted to help. Good luck :)

alt text

capture2.png (102.6 kB)
more ▼

answered Jan 22 '19 at 06:21 PM

avatar image

Ahmed_123
3 2 4

(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