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 to compare orientation + position of two actors?

Hey I hope that anybody can help me. I want to make a case study that shows the advantages of augmented reality and for that I want to create a 3D interactive puzzle with a 3D instruction. At first I have to say that I have no experience with unreal engine and English is not my native language so I hope that I can explain my problem reasonably clear.

I have 12 different components that should be built together. To show the user where the component should be placed, the position is marked by a hologram of the component. At the moment I placed two trigger boxes in the hologram and if the component begins to collide with both trigger boxes the component is static placed on this position. This is not a good solution because it doesn’t take into account the orientation of the component and it is very inaccurate.

Now my question: I want to compare the position and rotation of the hologram and the component that should be placed. The goal is that the user grabs the component and place the component on the same position with the same rotation as the hologram. And if this condition is nearly accomplished the component should be static placed on this position.

I would really appreciate any help I can get! Thank you in advance.

Product Version: UE 4.12
more ▼

asked Aug 02 '16 at 10:09 AM in Blueprint Scripting

avatar image

1 1 1 1

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

2 answers: sort voted first

Hello, Marie_Luise,

If you subtract the position of your component and your target, and get the length of the resulting vector, you will have the scalar distance between those two points. You could have a threshold value, so that when the distance is lower than your threshold you know that your condition is true.

As for the orientation, you can get the forward vector of each of your elements, your component and target. That will give you a normalized vector (origin at 0,0,0, length of 1) pointing to the orientation they have. Again, subtract both vectors and get the length of the resulting vector, and that will give you the difference between both orientations as a scalar, where 0 means both orientations are the same.

Again, you would have a threshold value (ej. 0.1) that you would compare to, so that when the diference in orientation is lower than that value, your condition is true.

When both tests return true (you can use an AND node for that), then you would set the position and rotation of your component actor to that of your target.

Hope it makes sense. All the best.

more ▼

answered Aug 02 '16 at 10:25 AM

avatar image

596 13 10 34

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

Hi Marie-Luise!

You could you could also use a Delta Rotator to compare orientation, as I show in the image. Where Active Arrow is the actor that moves (your Component) and Target Arrow is the stationary actor you want to compare orientation with (your Hologram). The float LockOnPercision has the value of the orientation difference that is acceptable.

alt text

Hope this helps.

more ▼

answered Aug 02 '16 at 10:45 AM

avatar image

206 7 13 18

(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