Log in or register to post comments

Get the current rotation of ImageTarget

March 22, 2018 - 10:13am #1

I have a defined ImageTarget and I get it's position by

ImageTarget.transform.position; // -> Vector3(x,y,z)

 

But the the rotation is always the same, it doesn't change when I move/tilt my Camera

ImageTarget.transform.rotation; // Quaternion(x,y,z,w)

 

 

My Qustion Is:

If I look at the ImageTarget straigt, but the imagetarget is rotated, then how can I get this rotation value from the Imagetarget?

 

Get the current rotation of ImageTarget

April 2, 2018 - 2:54pm #4

The Transform of the ARCamera should have these values for you.

Thanks,

Vuforia Support

Get the current rotation of ImageTarget

March 27, 2018 - 12:47am #3

Well, it is set to CAMERA, and the object inside rotates, but I need the rotation values relative to the Camera.

 

I am setting the position of the nested object in code. I get the position of imagetarget, calculate the difference between them, and it works well. But if I turn around (for example 90 degrees) the (distance)position is calculated correctly, but it is 90 degrees in the wrong direction. 

 

Thats why I need the rotation to calculate the relative rotation. 

 

 

I think I know how I could do that.

I will need this :D

Camera.main.transform.rotation;

 

Get the current rotation of ImageTarget

March 23, 2018 - 10:19am #2

Hello Norair,

What do you have the "World Center Mode" set to on your ARCamera? If it is set to "FIRST_TARGET" this will make your first target detected always be 0,0,0 with everything rotating around it. If you set this field to something else, such as "CAMERA" you'll see the target rotate.

Thanks,

Vuforia Support

Log in or register to post comments