简体   繁体   中英

iOS ARKit & Unity angles syncing

I am working on AR App(s). We have a Unity app and iOS app. we place different objects on different locations with help of server. This is working well in unity and iOS. Only issue I am facing is about rotation angles.

Unity app gives rotation angle like "transform.localRotation" or "transform.rotation". And in iOS ARKit I provide angles to node like "node.rotation" or "node.orientation" or "node.worldOrientation" But I am unable to make any combination work. Angle of object in Unity differs from angles of object in iOS. How can I make them sync accurately?

You have to convert angle(xyz) into quaternion(xyzw).

Vector3 angle = new Vector3(0, 0, 0);
node.rotation = Quaternion.Euler(angle);

and it's very basic of getting angle from rotation.

node.rotation.eulerAngles

btw, this is something basic... please be reminded.

the last thing I guess, is mis-matching angle value between Editor Inspector and the output. Please be reminded that the Inspector value is just for preview purpose, which you can input any range freely(>360 or < -360..etc).

But rotation from transform should have a default range value.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM