How to change de up axis

0 votes
asked Mar 18, 2022 by adenio (1,250 points)
edited Mar 18, 2022 by adenio
How can I change the up axis of EasyAr from y to z (like Blender)?

Some time ago i made this in ImageTrackerBehaviour script, like this:
After using:
       var pose = Utility.Matrix44FToMatrix4x4(targetInstance.pose());
I made a change in the line:
       pose = args.ImageRotationMatrixGlobal * pose;
to
       pose = args.ImageRotationMatrixGlobal * pose * Matrix4x4.Rotate(Quaternion.Euler(-90, 0, 180));

How can I fix this now?

Thanks for help.

1 Answer

+1 vote
answered Mar 18, 2022 by kenn (18,750 points)
edited Mar 18, 2022 by kenn
Don't understand why you are doing this. Looks like you were using a very old version, maybe you will find what you are doing not necessary in latest version.

And, have a look at this, it may help if you think the up axis of EasyAR is pointing to some whatever axis in Unity.

https://help.easyar.com/EasyAR%20Sense%20Unity%20Plugin/latest/ApiReference/ARSession.ARCenterMode.html
commented Mar 21, 2022 by adenio (1,250 points)
edited Mar 21, 2022 by adenio
Thank you very much Kenn... but that didn't solve my problem.
We made our first AR apps with an old version of EasyAR (3.1 - free), but now we bought the license (4.5) and ran into this issue (which had been resolved, in version 3.1, as described above).
All character movement scripts are using the Z axis as the vertical (up) direction, but despite changing the "CenterMode" target (Camera/First Target/Specific Target/Session Origin), whenever the section starts, the axis vertical reverts to the Y axis, leaving all the content inside the "ImageTargetController" object, lying in relation to the device's camera... If you have any suggestions to solve this, it would be most welcome.

PS.: Also, when tapping the screen to move the character, it's natural to use Unity's x and z axes to indicate the character's movement back and forth (3D), and not the screen's x, y (2D) axis, which is not indicate the depth of movement, but only in sideways, up and down.
commented Mar 21, 2022 by kenn (18,750 points)
I'm still not quite understand. It sounds like a pure 3D question to me. For example, if you put an empty node under ImageTargetController, and put all other things (like your character) under the new node, will rotate the new node fix your problem?

EasyAR solves the transform between ImageTargetController (there has to be an object to represent it in 3D space anyway) and the camera, you do not have to change that in almost every condition. Mathematically, if you can decompose your desired transform T into EasyAR's transform E and another transform X, then you can simply represent X with a child node of E in Unity.

If this still not solve your problem, would you say it cannot be solved without changing the transform between ImageTargetController (it's just a empty node) and camera? If yes, a video or sketch showing what you want to do would be preferred.
commented Mar 21, 2022 by adenio (1,250 points)
Yes. This was the solution I adopted.
I created a new object and place the others in a hierarchy below it. Unfortunately I will have to readjust all the scripts that produce character movements.

But I imagined that if it were possible to make this adjustment (change the vertical vector), in the same way that it is possible to do a "horizontal flip", it would be much easier, and would give more flexibility to the plugin.

For now, this will be the solution I'm going to use... maybe in a new version of the plugin it will be possible to offer users this additional feature...

Thanks for your response!
commented Mar 21, 2022 by kenn (18,750 points)
edited Mar 21, 2022 by kenn
Well, horizontal flip is provided in a different reason, because the camera image is sometimes required to be flipped, and a usual linear transformation in 3D space is not enough.

We design the plugin to be as simple as it ca be, to expose EasyAR Sense features to Unity as its main target. So things you can do separately using raw Unity features would usually not be considered as the plugin feature. (Decouple AR and 3D)

In addition, if we make a new 3D engine from scratch with AR as first class citizen, we can decouple AR and 3D in a better way.
commented Mar 21, 2022 by adenio (1,250 points)
Yes, I understand the reason for the "Camera Flip". But I only mentioned this to give an example of how I would like to see this new option, i.e. change the vertical z or y axis.
I think if it were possible to add this option, it would be very interesting!
commented Mar 21, 2022 by kenn (18,750 points)
You are right. We will take that into consideration. What I mentioned was from the view of plugin architecture design, and I would prefer clear product boundary, since Unity is too flexible for us to maintain every possibilities.
commented Mar 23, 2022 by adenio (1,250 points)
Adding this option would be great and very welcome!
Thanks Kenn!
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...