Unable to rotate to target using BP

Hi There.

I’m working on a tower defense type project and I am trying to get my ‘Tower’ to rotate to my target. The turret rotates around its socket correctly but the direction is slightly off (See gameplay screenshot)

I’ve tried adding 90 to my float (See Changes Screenshot) But this corrects on direction and offsets the other direction even more(Makes sense to me why)

Please have a look at my screenshots of what I have.This method that I am using used to work but I have changed a lot of things and my version twice and only realized now when adding more turrets to my game that it is not working correctly.

I have checked all my models and made sure they are all facing forward and center in scene.Same for my sockets.

I would really appreciate any help here.This seems like such a small problem for the progress I’ve made in this game its sooo frustrating!

Thank you in advance

Bumping this because it seems like a small problem stopping me from progressing further.Any advice will be appreciated.Thanks

Hi Mad_Marza
try FindLookAtRotation in this function start vector will be your turret location and target will be your target vector.
you have to put this with a tick

target of the set actor location will be you turret.

Thanks for the reply. Same results.This is basically exactly what I had.Have a look

Same results if I change target to get world location

I use Find Look At Rotation and Set World Rotation and your logic looks correct.

Initially, I’d double-check that you are properly referencing the two vector targets (especially the Target actor from the array… to do it quickly use a Print String on the Target actor toot component’s Get World Location or something)

Okay I made a new blank BP and used a cube, cone and arrow. instead of getting my target from an array I used a static target point on the map.Same results… This is so simple yet so confusing whats the malfunction here ::frowning: :frowning: alt text

u have to set the target of the setActorRotation with your turret reference .

the result you will get will look like this

Good Point thanks @aNorthStar but yea end result is incorrect.I did interpolation anyway to test same result my angles are out.I’m going to create a test project and do everything over to see what happens and I will post my results.Thanks for the help

ummmm… actually @OoKushoO… the static vector that @MadMarsza is using should be sufficient…

it looks perfectly fine to me, do you have the correct NewBlueprint actor in your level? Also, without any interpolation, the rotation will happen pretty much instantly, so you might actually not actuall see it rotate… just the end result

I’m looking forward to your results with interest. For simplicity, you might try rotating the whole Actor in it’s own blueprint, starting with static vectors… as you likely know, ensure it’s set to dynamic actor :slight_smile:

The process looks correct, How do you get your actors references? Maybe your Turret is unable to do the OP because it don’t have the actor ref to target.

On a new project with a new BP it works perfectly.Sooo confused

So testing my original BP in the new project its still not working.So yea its gotta be user error then,I’ve gone ahead and recreated the entire blueprint without copying and pasting(Redid everything) and same problem.So i’m wondering if its my mesh that is affecting it somehow

Its on a branch on the tick so it won’t fire at all if the target isn’t detected,meaning if it fires the branch has passed and the target is locked. I’ve confirmed this with simple print strings.The targets gets added and removed with an overlap and only targets that has a certain tag will get added to the array.

Update : Using a static world location as a target doesn’t work. Trying any different target doesn’t work and recreating the BP in its simplest form doesn’t work.Creating a simple BP with Geometry works perfectly so, can this be related to my mesh in any way? My mesh is 0 on X and Y axis and I’ve also removed the sockets to try and move the whole mesh instead of just socketed parts,still same results.

sure is a puzzler… something this fundamental isn’t likely to be a bug though… it’s likeliest just a tiny user error in the settings… something itsy bitsy gone askew somewhere :slight_smile:

…eliminating the Branch temporarily, does it work with static world locations and different targets?

it really sounds like the Branch

Nope unfortunately not.I recreated my turret in its simplest form.No branches no target arrays just the basic logic straight in the event tick with a static location as my target.Nothing.Its gotta be mesh related because it works with simple geometry.Everything is on 0 axis so I don’t understand how this could be a problem.Going back to Maya now to double check everything and export and reimport.