Log in or register to post comments

3d tracked object position

January 23, 2013 - 2:22pm #1

Hello,

Starting from the ImageTargets sample, I want to achieve the following:

1) Keep the tracked object active, even if tracking is lost.

2) Keep the tracked object in the same position in 3d space when the camera looks away.

I accomplished #1 by removing the call to OnTrackingLost().

I am having trouble with #2.  When I move the camera away from the target, my 3d object is dragged with the edge of the camera.  I want to be able to look away and then come back to find the object in the same place.  I'd also like the object to move around the room via animations and be able to follow him with the camera. 

Any ideas on how to achieve this?  Any gotchas to look out for?

 

Thanks for your help.

3d tracked object position

February 18, 2013 - 8:16am #4

Hi mickbanks,

provided that you are aware (as I said previously) that the accelerometer may not be very accurate (especially with respect to "drift" issues over time),

if you want to use the accelerometer to estimate target-to-camera motion when the target is not tracked by Vuforia, you could follow these general guidelines:

  • implement a custom behaviour extending the ITrackableEventHandler interface to detect when a Trackable gets lost by Vuforia (you can also adjust the code in the DefaultTrackableEventHandler already used in ImageTargets)
  • in such implementation, save the last trackable position and orientation in a member variable, so that you know where was the trackable last time it was tracked by Vuforia (i.e. before getting lost)
  • during the time that the Trackable is lost (i.e. until it is not found again by Vuforia), update the Trackable position and orientation by using some computed values based on the accelerometer sensors

You can search the Unity3D forum for advise on how to access the device accelerometer in Unity, for instance, here is one:

http://answers.unity3d.com/questions/63433/moving-an-object-with-accelerometer-using-unity-ip.html

3d tracked object position

February 18, 2013 - 7:21am #3

I'm  having the same problem .. the object simply sticks to the camera screen..     I am interested in  using the iPad's accelerometer to get camera positioning relative to the last recorded target card position.  

 

3d tracked object position

January 24, 2013 - 1:43am #2

Hi garing,

the reason why the object is dragged with the camera edges, is because by disabling the OnTrackingLost, your trackable will just remain in the 3D scene and will be positioned in the scene using the last transformation (position + orientation) that was updated by Vuforia the last time it was detected.

So, since the transformation computed by Vuforia represents how the trackable appeared with respect to the camera, that transformation will remain "frozen" in time (as Vuforia cannot update it anymore, due to the fact that the traget is no longer detected) and as a consequence the object will appear static in the camera reference frame (i.e. as if it was attached to the camera, and thus dragged around with the camera)

 

A possible solution to that would be to use the Device accelerometer and orientation sensors to keep track of the device position and orientation in the real world, and when the trackable is not detected any more, use this information to estimate the motion of the device (i.e. the camera) in 3D space, and update the position of the trackable accordingly.

This is however a rather sophisticated solution, and I cannot tell if it will be accurate and robust enough. If you're willing to spend some time trying it, it might be a nice experiment though.

I hope this helps.

Log in or register to post comments