Topic locked

Marker's position in relation to another

July 7, 2021 - 2:39am #1

Hello,

I want to do something that I thought was simple but doesn't seem to be in reality.

I need to register the position of a marker in relation to a second marker. This position is stored and can be loaded later on and represented by an object. To do that, I calculate the Delta in position and rotation between two objects which are respectively children of both markers. (Each object models one marker's position and rotation)

Delta_pos = Obj1_pos - Obj2_pos;

Delta_rot = Obj1_quaternion * Quaternion.Inverse(Obj2_quaternion);

 

When I load my file, I place a third object on the desired location thanks to this calculation :

transform.position = Obj1 + Delta_pos;

transform.rotation = Delta_rot* Obj1_quaternion;

 

But with this code, it's not working, and the object is not always loaded in the good place (but sometimes yes). I'm pretty sure, there is an easy answer to this issue but i'm not familiar with the coordinates in Vuforia. Thank you in advance to the people who can help me !

 

Marker's position in relation to another

July 8, 2021 - 4:10am #2

Hi,



better to understand when you say markers- do you means some functionality as shown in the video https://youtu.be/l-vbHvVE1Y0 //  video is to OpenCV plus Unity sample assets https://assetstore.unity.com/packages/templates/tutorials/ar-marker-detector-80086



How did you implement in Vuforia Engine - e.g. did you use as parent object an Image Target?

In the Vuforia developer portal -  there is a background info about the content positioning  so e.g. info is  mentioned in the articles (relevant is only the Unity part)  https://library.vuforia.com/articles/Solution/Working-with-Vuforia-and-OpenGL-ES.html and https://library.vuforia.com/articles/Solution/Working-with-the-Camera.html

But, so far I understand your issue  your goal to fix the position of second content (2) relative to another object/ content (1)  and sometimes the simplest way will be to  make it child to the marker/ parent object   (1) . This will   fix the relative position (shift and rotation)

I think your issue is more related to the Unity functionality and possibly you can find the solution in the different  unity3d forums



e.g. about some calculation of relative positions between object in unity we can fine information when we search in google – e.g.:

Get the difference between two quaternions and add it to another quaternion /https://forum.unity.com/threads/get-the-difference-between-two-quaternions-and-add-it-to-another-quaternion.513187/

 but also other related

https://forum.unity.com/threads/how-to-calculate-the-new-transform-values-relative-to-parent.447609/

https://forum.unity.com/threads/calculate-a-new-position-based-using-an-angle-and-distance.136444/

https://docs.unity3d.com/2019.3/Documentation/Manual/DirectionDistanceFromOneObjectToAnother.html

https://www.quora.com/How-can-I-make-an-object-stay-in-the-same-position-relative-to-the-camera-in-Unity



Possibly there is sometimes a relative shift (translation , rotation) or scale factors to the parents so that the calculation will not consider it…

I think another  point what could be important from the Vuforia side is the setting of AR camera of the World Center Mode : device , first target

 

BR

Vuforia Engine Support

AttachmentSize
Image icon 2021-07-08_12-58-00.jpg41.56 KB
Topic locked