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.
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.
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.
Hope this helps.