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"

Actor look at spawned actor

Hi,

I'll try keep this as short as possible, i'm making a tower defense game and i have managed to implement the spawning of the enemy ai and navigation. I have also managed to make my tower cannon face my player with Find Look at Rotation for testing, now i need to find out how i can get my tower cannon to face the nearest enemy ai which has spawned and ran by it (i have the range covered).

or in short, how do i get one actor to face another actor which has been spawned? alt text

Product Version: Not Selected
Tags:
unrealhelp.png (185.1 kB)
more ▼

asked Mar 08 '15 at 02:08 PM in Blueprint Scripting

avatar image

Conno
19 10 16 16

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

1 answer: sort voted first

I can't test this out atm but you could try having a sphere component to your tower. Also create an Variable of Actor Array. Have Begin Overlap Event from the Sphere Component. When an enemy enters the sphere, add it to the Actor Array. This is so that you can track multiple enemies enter the tower range. Now get the tower to target the first index of the actor array. Before the turret shoots, check if the target is valid, if it isn't, it means the actor has died. Remove the element from the array and target the next one. Now you also need a End Overlap Event event from the Sphere Component to remove the enemies from the Actor Array when they exit the Sphere Component which is your range. This is just an ideal.

Also, if you go to the Learn Tab of the UE4 Launcher and scroll down, you can download the Strategy Game Content Example which I think is a tower defense game. You could see how they did it, thought they may have used c++ for that mechanic. Check it out!

more ▼

answered Mar 08 '15 at 03:07 PM

avatar image

Mortusnyte
916 45 20 77

avatar image Conno Mar 08 '15 at 06:37 PM

managed to get it to work :D check out the screen, awesome, thanks :D!

alt text

ftwunreal.png (296.4 kB)
avatar image Mortusnyte Mar 08 '15 at 08:12 PM

Awesome! Glad to hear you got things under way :) I wish it wouldn't convert the thread to Not Accepted from leaving a comment. I really wanted to tell you great work! Well I guess you have to accept the answer once again now :P Sorry!

avatar image Erasio Mar 08 '15 at 09:36 PM

Np. We can take care of that ;)

Never hesitate from commenting like that because of this! That's more than fine and if we should ever oversee it just pm me on the forums.

Cheers :)

(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