Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Jens 1 · Oct 18, 2010 at 07:47 PM · rotationflash

Rotation problem

Hi,

I'm using FLARToolKit (flash) to create an Augmented Reality-game in Unity. I have managed to send over the rotation values and by that rotate an object in Unity.

This works fine at first glance (see a small demo here: http://vimeo.com/15606701), how ever, if you tilt the marker to the left with the front still facing the camera and rotate the marker horizontally, the object will rotate vertically and vice versa.

It seems that the object rotates verticaly even if it "lies down". I made a small video of the problem here: ( http://jensborjesson.se/AR/rotationProblem.mov )

The code for the rotation is:

public void moveCSharp(string direction) { string[] vec3 = direction.Split(' ');

 target = Quaternion.Euler(float.Parse(vec3[1]), float.Parse(vec3[0]), float.Parse(vec3[2]));
 transform.rotation = Quaternion.Slerp(transform.rotation, target, Time.deltaTime * 20f);

Does anyone have any idea what could be the problem?

Thanks in advance Jens

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Cyb3rManiak · Oct 18, 2010 at 10:10 PM

It looks like maybe one of the axes is reversed. It almost seems logical if when you first turn the page on its side - if the cube went the other way (reverse the first axis you moved the cube on in that video) - it will all make sense, but kinda hard to visualize, so I'm not sure.

The best way to approach this is if you can post what you send from FLAR (what method of FLAR do you use to get the rotation and how do you send it to Unity).

Is the FLAR rotation is the rotation of the object or the camera? Is there a chance that the coordinate system of FLAR is not the same as Unity's? (RHS vs LHS if you know what I'm talking about).

Also - Euler angles are probably not the way to go. If you can get a Quaternion rotation from FLARToolkit, it will be much easier and neater to use in Unity. Since FLAR is based on ARToolkit - there must be a method to do this. In ARToolkit it's arUtilMat2QuatPos();

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jens 1 · Oct 19, 2010 at 12:01 AM 0
Share

Thanks for the quick answer. The reversed axes only happens in the situation as in the video and when it is lying flat on the table. The axis works fine when holding it straight up to the camera as seen in the other video.

I send and receives a string based on a 3D matrix of the rotation in FLAR. These are correct values (I print them out in the GUI). The difference is that these values goes between -180 to 180 while Euler in Unity automatically converts these values to 0 to 360. Also, FLAR and Unity have different orders of the x and y axis.

avatar image Cyb3rManiak · Oct 19, 2010 at 12:13 AM 0
Share

That's why I'm saying you're better off using Quaternions. These flips will drive you mad.

Try and search how to extract the position and rotation in Vector3 and Quaternion from the matrix. As I said - there has to be some method in FLARToolkit that does this. guaranteed. If you can't find one, I'll try and look it up for you, but it's well worth the effort.

avatar image Jens 1 · Oct 20, 2010 at 10:38 AM 0
Share

I don't think you can send Vector3 and Quaternion through ExternalInterface (from flash to unity). And I still don't think that is the problem since everything is working just fine until the problem occurs

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Different programming in Flash? 0 Answers

A node in a childnode? 1 Answer

Rotate only Y-axis of some object toward another 3 Answers

Problem with locking rotation 1 Answer

Transform rotation 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges