Start a new topic

Remove Cam temporarily

Remove Cam temporarily


Hi,

I have some POI's showing in the AR World. When I'm approaching to one of these, POI will disappear and HTML buttons will appear. I do this using removeCamDrawable method. When I walk away from the POI, I want to show POI Label again, but I can't because I used removeCamDrawable method before... How can I do this? 

 

This is the code

locationChanged: function locationChangedFn(lat, lon, alt, acc) {

 

        

// request data if not already present

if (!World.initiallyLoadedData)

        {

World.requestDataFromLocal(lat, lon);

World.initiallyLoadedData = true;

}

        else

        {

            var newLocation = new AR.GeoLocation(lat, lon, alt);

            for(i=0;i< World.markerList.length;i++)

            {

                // Updating POI distance

                var newLocation2 = World.markerList.markerLocation;

                var distanceUpdate2 = (newLocation2.distanceToUser() > 999) ? ((newLocation2.distanceToUser() / 1000).toFixed(2) + " km") : (Math.round(newLocation2.distanceToUser()) + " m");

                World.markerList.descriptionLabel.text = distanceUpdate2;

                

                // Loading Camera if distance is <= 5m

                

                if (Math.round(newLocation2.distanceToUser()) <= 40)

                {

                    if (! World.yetLoad)

                    {

                        World.yetLoad = true;

                        var markerNear = World.markerList;

                        markerNear.markerObject.drawables.removeCamDrawable(markerNear.markerObject.drawables.cam);

 

                        jQuery("#info").show();

                        jQuery("#3D").show();

                        jQuery("#3D").click(function()

{

                            jQuery("#3D").hide();

    jQuery("#info").hide();

    jQuery("#return").show();

                            var model = new AR.Model("3d/"+markerNear.id+".wt3",

    {

onLoaded: function()

{

                                                                     

    markerNear.markerObject.drawables.addCamDrawable(model);

                                        //this.scale.x = 0.01;

                                        //this.scale.y = 0.01;

                                        //this.scale.z = 0.01;

                                                                     

}

                           });

  jQuery("#return").click(function()

  {

                                markerNear.markerObject.drawables.removeCamDrawable(model);

                                jQuery("#info").show();

                                jQuery("#3D").show();

                                jQuery("#return").hide();

  });

                        });

                        jQuery("#info").click(function()

                        {

                                jQuery("#info").hide();

                                document.location = "architectsdk://clickOnObject?param="+markerNear.id;

                        });

                    }

                }

                else

                {

                    World.yetLoad = false;

                }

 

            }

        }

}

 

 

Hi Luca,

Set GeoObject.enabled value to false or true.

You may therefore hide & show the label or any other GeoObject without destroying it.
Try to recycle existing GeoObjects instead of recreating them on every location update to avoid flickering.

Kind regards,
Andreas
Login or Signup to post a comment