"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

freezing the AR when tracking lost

Just wondering about the easiest way to make this happen. I've created my own implementation of ITrackableEventHandler, so that I can control the time limit before displaying text to alert the user that tracking is lost, etc. I'd like to be able to extend this to "freeze" the AR when the user wants. For instance, say he enables the AR via the tracker, but then wants to pull the device away and still interact with the AR. So I'd like to have a button that he can press to freeze/lock the AR at a desired view. Any thoughts?

If you want to freeze the position of the 3D object on the screen you can disable the QCARBehaviour: [CODE] QCARBehaviour qcarBehaviour = (QCARBehaviour)UnityEngine.Object.FindObjectOfType( typeof(QCARBehaviour)); qcarBehaviour.enabled = false; [/CODE]

You could deactivate the TrackableBehaviour attached to the target (for image targets the subclass is ImageTargetBehaviour). This will cause the OnTrackableLost method of the DefaultTrackableEventHandler to be called, however, which will turn off the renderers of any child objects.

jacksmash

Wed, 04/18/2012 - 13:22

[QUOTE=ksiva]You could deactivate the TrackableBehaviour attached to the target (for image targets the subclass is ImageTargetBehaviour). This will cause the OnTrackableLost method of the DefaultTrackableEventHandler to be called, however, which will turn off the renderers of any child objects.

Then another option is to "unbind" the content from the trackable to freeze it. If you set the content's parent to null it should stay fixed in its last position.

jacksmash

Thu, 04/19/2012 - 19:52

Ok, I'll try that. Thanks! [QUOTE=ksiva]Then another option is to "unbind" the content from the trackable to freeze it. If you set the content's parent to null it should stay fixed in its last position.

jacksmash

Mon, 04/23/2012 - 20:38

[QUOTE=ksiva]How about parenting it to the camera? - Kim[/QUOTE] I appreciate all of your input on this. My last problem is regarding character movement.

Is the character being moved relative to its parent? For example, you should be changing its localPosition rather than position. Is anything about its movement dependent on the world position and forward vector of its parent? - Kim

jacksmash

Mon, 04/23/2012 - 22:58

Sorry, I should clarify that the Character Controller is on the parent of the character. I need to edit my above post because I just realized that it didn't show the hierarchy correctly.

jacksmash

Mon, 04/23/2012 - 23:05

[QUOTE=jacksmash]Sorry, I should clarify that the Character Controller is on the parent of the character. I need to edit my above post because I just realized that it didn't show the hierarchy correctly.[/QUOTE] Done editing. Hopefully it makes it a little clearer.

jacksmash

Tue, 04/24/2012 - 00:55

I've figured out what is happening... somewhat. Since I store the CharacterParent's initial position and rotation, when I "freeze" the scene (by parenting AROrigin to ARCamera), the CharacterParent still moves w.r.t.

jacksmash

Tue, 04/24/2012 - 17:09

[QUOTE=jacksmash]I've figured out what is happening... somewhat. Since I store the CharacterParent's initial position and rotation, when I "freeze" the scene (by parenting AROrigin to ARCamera), the CharacterParent still moves w.r.t.

[QUOTE] I'm wondering if I'm going to need to do some math here. [/QUOTE] Most likely :) Unity provides a lot of math functions that should makes things easier though. Ideally your character controller would be completely based on the local transform of the character.

jacksmash

Wed, 04/25/2012 - 02:08

I can try that out tomorrow... but in the past I remember looking it up and learning that you can't change that setting at runtime (at least via the function call).