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"

How do I compare the rotation of an actor with the vector of a ray?

I'm trying to determine whether a line between two actors is equal to the rotation of one of those actors. The idea is to be able to be able to tell if certain actors are aligned with each other. alt text

I've tried to do it with a ray trace, but it doesn't really matter if the ray hits the actors, just that I can have the line to pull information from. If a ray trace is the best way, any suggestions on how to make it work? If there's a better way, I'm all ears.

Product Version: UE 4.14
Tags:
actor alignment.png (146.9 kB)
more ▼

asked Dec 01 '16 at 06:43 PM in Blueprint Scripting

avatar image

Gravijah
1 2 3 3

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

1 answer: sort voted first

As long as you want the second object to be aligned along the first's X, Y, or Z axis, you can for example find the Up Vector of your first object and then find the normalized line between the two objects. If they are equal or roughly equal, they should be aligned.

more ▼

answered Dec 01 '16 at 06:59 PM

avatar image

thevfxguy13
369 6 7 19

avatar image thevfxguy13 Dec 01 '16 at 06:59 PM

Use Up, Forward or Right Vector accordingly.

avatar image Gravijah Dec 01 '16 at 07:26 PM

Thanks! How would you go about finding the normalized line between the two objects?

avatar image thevfxguy13 Dec 01 '16 at 07:37 PM

You can subtract their two locations and then there should be a "normalize vector" function.

avatar image Gravijah Dec 01 '16 at 08:39 PM

Here's the setup I have. I'm not getting the result I'm looking for. Maybe I'm missing something? alt text

avatar image Gravijah Dec 01 '16 at 08:55 PM

I swapped the top and bottom GetActorLocation nodes and it worked! I guess I'll need to add in a way to get the inverse value. Thanks a ton!

avatar image thevfxguy13 Dec 01 '16 at 09:12 PM

No problem!

(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