Trying to track and shoot a target

First of all I’m just trying to make a basic tower defense level.
At the moment this is mainly what I have. The first picture is my spawn 1 unit function that spawns a unit and sends it to a TargetPoint (called endzone). The second picture is the event graph of my level BP, the store_enemies is a macro that simply gets the actors and puts it in an array, it’s not terribly useful right now, however I plan on adding more pins to it to separate enemy units when the time comes. It spawns 5 units and they run towards the TargetPoint. My shooter shoots as they pass by, but not at the spawned units. Also, I think it might be also just shooting 1 time for each unit, I assume because I don’t have it looped, because at the moment I have no access to the arrays that holds the units.

My main issues:

  1. I have no idea how to keep my “shooter” in place but also be able to spin towards his target.
  2. To be able to spin towards my target I need to be able to track it somehow. My original goal was to use the array to track the individual units inside of it. However, I realized my shooter_bp can’t access my arrays in my level_bp. So I then tried to move everything out of my level_bp, but then realized I couldn’t reference the TargetPoint then.

Any ideas ?

Hi Jaytaz!

I advise you to take a look at Shape Traces in Unreal, that could handle a lot for you tower mechanics, without actual need to store your enemies. Take a look at this articles and samples to get an idea:

I think this could be really interesting for your attack mechanic - Towers will check a radius around them, then get first/multiple actors it get hits, extract pawn and make damage to it based on the Trace results (they also could be used as a start/end points for your particle effects).

Hope you will find that approach helpful!

Okay after reading through the information about Raycasts and Behavior trees I found out a bunch of interesting information. Right now I am trying to manipulate the given example on the behavior trees to only rotating to the target instead of running to the location itself.

From my understanding the example is finding the location of the objects. So I decided to try and use the rotate to face bb entry. This is working pretty well actually, however, the movement is very choppy. I tried to add in a wait time, however that doesn’t seem to help much.

I read something about RInterp, however I am having a very hard time figuring out where/ how I would even use it.

This is what I have been trying.



Have not so much time to research this question, but I think the way it should work is to make custom Task in your Behavior Tree instead of face to BB query. In my simplified example it looks like this:

You should do some math to get the Rotator to target, but I think that’s not so difficult.

Hope that’ll help!

You use a Tick in a Task? Shouldn’t that be Event Receive?