Start a new topic

Bad Scale when Target is Lost

Bad Scale when Target is Lost


When SnapOnScreen is used:

After I scan, if target is tracked, the scale is good, But,

After I scan, if target is lost, the scale is bad, if I back to target and track it then lost again, the scale will be good.

 

What is the problem ? and How to solve it ?

 

Thank you,

Hi,

Can you please explain in more detail what you mean by scale - please also include screenshots that show the behaviour.

Thx and greetings

Nicola

I mean by scale->size of content i.e image, 3d model ... etc.

I use AR.context.scene.globalScale = -1; in onSnappedToScreen function for Trackable2DObject.

But, the result is different.

The first image's senario: Scan -> Lost target -> Snap (lost target) and let content load -> (result) size/scale of content is small.

The second image's senario: Scan -> Track target -> Don't Snap and let content load -> Snap After content loaded (so content appears first on target) -> (result) size/scale of content is good.

*The second size is the correct one.

Thank you,

 

 

 

 

 

 

Hi,

Technically the snapContainers dimension and position is used to know where to render the Trackable2DObjects once snabToScreen is enabled. It is not possible to change dimensions of the div on the fly and expect them to be taken into account right away. Solely rotation changes of the device will trigger a refresh of the dimension/scale/position.

Please also check the sample app implementation.

Greetings

Nicola

Thank you Nicola for reply,

In SDK samples, the 3_3dModels_4_SnapToScreen sample, use snap to screen after Car Model appearing on Target, not after Lost target. (and this case works great with me as i said before). That may be good for static 3d model which is attached in the project's assets.

But I load content from server, which need time and preloading progress, so I can't say to client you have to focus on target till loading of content completed. I have to lost target and give content some time to load, in THIS case the scale/size of content become WRONG.

Can that be solved ? , I hope my issue is more clear now.

Thank you,

Hi,

In our snap-2-screen video sample the video is 'snapped' once the target is lost. Please check this sample on how to handle snapping when the target is lost.

Greetings

Nicola

Sorry Nicola, But you did't understand me.

I saw this samples of snap, also Car Snap model. All of them are static and don't take any time in loading, my content from server take some time, for more unability I use SnapToScreen, so the content will be shown after a while when the target is lost. The content WON'T appear first time on target, But in the first time it will be Snapped. here the scale be uncorrect.

Do you get my point ?

Hi there!
 

Not sure if I got you right, but could you try setting scale to 1.0 on creation of your augmentations (in constructor) and update the scale in onEnter and onExitFieldOf Vision - e.g. scale = 0.8 in onEnterFoV and scale=1.0 in onExitFoV

Please let me know if that touches or even solves your issue ;-)

Best regards

Andreas

Sorry Andreas, that didn't help me, I'm still struggle for this problem

 

I'll try to simplify my problem again:

 

I load content ONLY when scan target (by addCamDrawable), and I use SnapToScreen technique, and my content is loaded for server not from project assets.

 

So, when I scan and remove mobile away from target (lost target), the content still loading and will be snapped to screen just it appears.

 

In this point (my problem occurs), the scale/size is small than the size if I scan and still see target (don't lost target), and this small scale/size will be corrected/bigger if I track target again and lost (here every thing will be okay) 

 

I hope you Andreas can understand my problem.

 

Thank you,

/

I see, so my approach / workaround should solve your issue.
Ensure to use scale 1 on creation of the Drawable2D, e.g. new AR.ImageDrawable(imageResource, 1, ... ), and set it e.g. to 1.1 in onExitFoV and to 0.6 in on EnterFoV. That way you ensure to always have the proper scale in place.
We're currently investigating a possible issue in the scale-value when set via constructor in combination with FoV triggers. The mentioned approach will anyhow also work after a 'bugfix'.

Thank you Andreas, but I still have problem

you mean scale of AR.ImageDrawable.scale or AR.context.scene.globalScale ?

I tried both but no good result, Also, scale = 1 make some images VERY big and its real size is 45x42 pixels, what is the resoan for that ?
Login or Signup to post a comment