Log in or register to post comments

Getting current target relative rotation

August 25, 2011 - 10:48am #1

Hi!

I've found several threads regarding similar topics, but must have missing something obvious...

I have a simple image target, and all I want is to get the relative rotation of the target from de camera point of view.

I've tried something like

TrackableBehaviour mTrackable = GetComponent<TrackableBehaviour>();

// And then accesing to x y z rotation like...
mTrackable.transform.rotation.x;
mTrackable.transform.rotation.y;
mTrackable.transform.rotation.z;

But I think these values are not what I'm looking for. Is there any other way to get the current target/marker rotation? (I'm working on unity extension C#)

Any help or clue is appreciated. Best regards!

Re: Getting current target relative rotation

August 28, 2011 - 11:07am #2

To get the relative rotation between two transforms you can use this:

Quaternion relative = Quaternion.Inverse(a.rotation) * b.rotation;

- Kim

Log in or register to post comments