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"

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)

alt text

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)

alt text

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!

alt text

Thank you in advance

Product Version: UE 4.18
Tags:
more ▼

asked Feb 22 '18 at 04:57 PM in Blueprint Scripting

avatar image

MadMarsza
22 3 3 7

avatar image MadMarsza Feb 26 '18 at 02:41 AM

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

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

2 answers: sort voted first

I wish I knew what the problem was but this fixed it.I imported the files into Maya and exported them again.I zero'd all the axis again even tho they were.I reimported the mesh in UE4 which did not change anything.I then again recreated the BP and now it seems to work perfectly.Thanks everyone for you help.I think this might have been a combination of user error and some sort of bug from upgrading the Engine.

more ▼

answered Feb 26 '18 at 01:50 PM

avatar image

MadMarsza
22 3 3 7

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

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 alt text

t1.png (128.4 kB)
more ▼

answered Feb 26 '18 at 04:46 AM

avatar image

OoKushoO
23 1 2 11

avatar image OoKushoO Feb 26 '18 at 04:47 AM

target of the set actor location will be you turret.

avatar image MadMarsza Feb 26 '18 at 06:17 AM

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

rotatebpissue.jpg (187.7 kB)
avatar image MadMarsza Feb 26 '18 at 06:20 AM

Same results if I change target to get world location alt text

rotatebpissue2.jpg (194.3 kB)
avatar image aNorthStar Feb 26 '18 at 08:30 AM

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)

avatar image OoKushoO Feb 26 '18 at 11:25 AM

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

alt text

the result you will get will look like this video https://youtu.be/p10rQMO71PM

rotation.png (69.9 kB)
avatar image aNorthStar Feb 26 '18 at 11:30 AM

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

avatar image MadMarsza Feb 26 '18 at 11:37 AM

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

avatar image aNorthStar Feb 26 '18 at 11:45 AM

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 :)

avatar image MadMarsza Feb 26 '18 at 11:58 AM

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

avatar image aNorthStar Feb 26 '18 at 12:02 PM

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 :)

avatar image MadMarsza Feb 26 '18 at 12:30 PM

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

avatar image MadMarsza Feb 26 '18 at 10:18 AM

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 ::( :( alt textalt textalt text

bpissue10000.jpg (296.7 kB)
bpissue10001.jpg (191.4 kB)
bpissue10002.jpg (289.1 kB)
avatar image CharlyB.Goode Feb 26 '18 at 11:59 AM

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.

avatar image MadMarsza Feb 26 '18 at 12:32 PM

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.

avatar image MadMarsza Feb 26 '18 at 12:36 PM

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.

avatar image aNorthStar Feb 26 '18 at 12:41 PM

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

it really sounds like the Branch

avatar image MadMarsza Feb 26 '18 at 01:26 PM

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.

(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