Log in or register to post comments

Tilting the scene in Unity.

September 24, 2012 - 4:51am #1



So, is it possible to tilt the game scene by tilting the AR target in real life?


For example; I have a ball in a room in the Unity scene. I want to pick up the AR target and tilt that left and right to move the ball.

Currently the scene is not relitive to what angle the card is. So if the AR target was upside down the scene would still be flat in the Unity world. 


Bit of a tricky one... Any takers? 

Tilting the scene in Unity.

September 25, 2012 - 5:52am #8

Thanks will PM you

Tilting the scene in Unity.

September 25, 2012 - 5:40am #7


the physics just seems right as long as you keep your device with the same orientation as the ar camera in your scene. that's why to do anything more advanced you need to establisch a reference to the real world rotation of the device by reading sensor values as i said in my previous post. i made a quick example project to demonstrate it. if you can give me your contact i can send it.



Tilting the scene in Unity.

September 25, 2012 - 4:10am #6

Thanks for this :)

Setting the world center to none works for the image target, so when I tilt it the plane follows suit.

Now it's just a case of finding the right orientation for the ball as it seems to drift off sideways, whether it is a child of the Image Target or of the Camera :(

Tilting the scene in Unity.

September 24, 2012 - 11:04am #5


try changing the world center mode of the ar camera in unity. setting it to "none" shoudl work fine. it will set your ar camera as the center of the scene. for more info about that have a look at the this: https://ar.qualcomm.at/qdevnet/sdk/android/Special%20Options%20-%20Android.

<edit> sorry, just saw that you wanted to work with physics. in order to emulate real physics, you should also rotate your virtual camera according to the actual rotation of your device (for example based on the accelerometer). unity offers also this option: http://docs.unity3d.com/Documentation/ScriptReference/Gyroscope-gravity.html but you should just try what gives the most reasonable results.

so to break it down i would try those steps:

1) orient the virtual camera based on the physical orientation of the device.

2) set the world center mode to "none" which makes the camera the reference for trackable orientation.

3) (done by the vuforia package) the trackables are oriented according to the camera.

i haven't really tried it myself but i'm quite sure this should get you in the right direction. </edit>




Tilting the scene in Unity.

September 24, 2012 - 9:50am #4

Sorry, I thought this might be simpler to achieve.

After discussions with a colleague I can try and steer you in the correct direction:

It is possible to get the Unity PoseData as a member of the TrackableData in the UpdateCameraPose() function of ImageTracker.cs (line 233) where you can see the loop that iterates through all the trackables found.  BTW both of these structures are defined in QCARManager.cs

I cannot tell you exactly how to do this but if you get the Quaternion from the PoseData for the ImageTarget, it ought to be possible to apply this to the orientation of the plane, and hopefully the ball will then obey the laws of physics...

You might find this thread helpful:  https://ar.qualcomm.at/content/rotation-and-posematrix

Let me know how you get on as I would be keen to see/try this myself :)


Tilting the scene in Unity.

September 24, 2012 - 8:04am #3

Thanks for replying NalinS,

The image target doesn't tilt when you tilt the physical AR Target. I tested this out by displaying the rotation of the image target through the GUI and it always stay at 0,0,0 no matter how you hold the AR target in your hand.

I may have misunderstood you, if i have just let me know :)

If not, any other thoughts?

Thanks again.




Tilting the scene in Unity.

September 24, 2012 - 6:45am #2

Hi jforder,

If you think about it the Image Target will tilt if you tilt the card, so the pose matrix should return position as well as orientation.

It should therefore be possible to apply the orientation to a Unity Plane and thereby achieve the effect you are after.

I think the plane/card needs to be an image target that is parented to the AR Camera.


Log in or register to post comments