How can I rotate objects in x or y axis attached to the ar target in unity

0 votes
asked Apr 2, 2020 by curiouselement (120 points)

I am using easy AR 3.1. I have problem with animating objects attached to the tracked target. 

This is my target object:


And this is my AR camera:

main Camera

So it works like this - when I am moving my physical camera looking at marker - values of position and transform of camera object are changing to make target stay in place that it should - based on tracking. And during whole process transform and position of target stay unchanged like world coordinates origin -- everything zero.

I am able to add any scaling or Z axis rotation of objects attached to the target but when I want to move them or rotate in X or Y axis everything goes wrong. In easyAR transform of position and rotation works in camera coordinates but not world coordinates so every action like move my object 100 units forward should be updated, I guess, with current transformation from camera but I dont know how? Some kind of inverse transform?

On my target I have a canvas rendered in worldspace with an attached image that I want to animate:

What should I do to move and rotate objects attached to the target? How should I change my transformations?  Now when I'm trying to rotate image around x axis I get this:

stretched but not rotated image Instead of rotation I get stretching. I used different options from unity like rotateAroundLocal / lookAt and so one but it looks that camera transformation is essential. Please someone help me ;)



Please log in or register to answer this question.

Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.