Center screen content on Tracking Unseen

Hi,

I want to center screen (Basically reset) the group / content when the tracking image goes out of vision. I have done something like this, but its not working as expected…

var flyer_jpgzpt0 = parent;
var group0 = symbol.nodes.expandedModel;
parent.on(“notseen”, () => {
group0.position([0, 0, 0]);
group0.rotation([0, 0, 0]);
group0.scale([1, 1, 1]);
});

Actually what I want to do is when we move the camera the group also moves according to the tracking image and this way sometimes the group goes out of the screen completely. When this happens and user keep moving the camera then the tracking image unseen event is fired. I also wanted to animate the group and set it at the center of the screen with rotations and scales set to 0. I am not sure how to do a timeline where the target will be animated from its current position (This is variable as group keeps moving with the camera movement on tracking image) to a defined position (center screen).

Can someone help me please.

Regards
Rakesh

I don’t know if I understand all that your asking for but as for the part with the time line and current position you just need to “link” the start of the time line to the first time spot (-# to 0) then it will play from wherever you move it to.
https://docs.zap.works/studio/getting-started/timelines/

Steve
Ps. If you can give me some more details I can try to help more.

Hi Steve,

I have no idea on how to set the initial values for the timeline. Here is the screenshot of the timeline. Can you guide me how shall I set the initial values, so that it animates from the current position of the target?

image

This is the latest timeline, but the group won’t move to the specified position on UNSEEN…

image

var flyer_jpgzpt0 = parent;
var group0 = symbol.nodes.expandedModel;

parent.on(“notseen”, () => {
Z.after(100, function(){
symbol.controllers.expandedModelTracking.elements.Tracking_toNotTracking.reset();
symbol.controllers.expandedModelTracking.elements.Tracking_toNotTracking.play(.8);
});
});

Please help :frowning:

Looks like you got the time line set. Did you change your relative to property from the target image to the Z screen?

Steve

How do I do that Steve?

The fastest way to help is for you open a new project. In the examples there is a project in ZapWorks Studio that shows this behaviour in action called “Tracking Grab-and-Go”.

From there I would copy the things to your code.

Steve

Thanks Steve, I’ll look into that example.

1 Like

Hi Rakesh,

Have you had a chance to look through the Tracking: Grab-and-Go example that @stevesanerd mentioned?

If you still have any questions after doing so let me know.

Thanks,
Seb