Start a new topic

Appear relative and keep absolute position.

Appear relative and keep absolute position.


Still can't find information, my idea is totally wrong??

If you want to keep objects still,

You should use latitude and longitude?? 

 

 

Use AR.RelativeLocations if you want to have objects permanently close to the user, e.g. an animated dog should always walk nearby.
As far as I understood you want to "drop an item next to the user", it should stay there and not follow the user's steps.
You need to use AR.Location instead and implement the AR.context.onLocationChanged to get lat/lon of user when "dropping the item".

Hope that helps
Best regards

PS.: Note that JS onLocationChanged event fires when location was set in native code (architectView.setLocation...)


Appear relative and keep absolute position.

For example, According to this article

location = new AR.RelativeLocation(null, 2, 1, 0);


This call shows object "2 points north and 1 point east" from where I am.

However if I move to somewhere, object also moves and it keeps "2 points north and 1 point east" relatively from me.

But I would like to keep the object "where it appears" absolutely.

These are my ideal behavior.


When objects appear they appear somewhere around me.

If I move toward them, I can get close to them. (They keep still).


Is it possible?

At first I have posted here also.

 

Hi Andreas

Thanks for your comment.

Your answer hits my point!

I implemented AR.GeoLocation and AR.context.onLocationChanged and made source code like this below.

keep GPS data in nowLat and nowLong variables.

AR.context.onLocationChanged = function(latitude, longitude, altitude, accuracy){

    nowLat = latitude;

    nowLong = longitude;

};

and show object around user, using slightly adjustment.

 var location = new AR.GeoLocation(

     parseFloat(latitude) + 0.00001, // about 1 meter easting

     parseFloat(longitude) + 0.00002, //about 2 meter northing.

     1// altitude

 );

 

Let me write down the code  for other people.

Thanks very much.

var nowLat;

var nowLong;

var World = {

    init: function initFn() {

        AR.context.onScreenClick = function(){

            showEarth();

        };

        AR.context.onLocationChanged = function(latitude, longitude, altitude, accuracy){

            nowLat = latitude;

            nowLong = longitude;

        };

    },

// 

//

}

function showEarth(latitude,longitude){ 

  var location = new AR.GeoLocation(

    parseFloat(latitude) + 0.00001, // about 1 meter easting

    parseFloat(longitude) + 0.00002, //about 2 meter northing.

    1// altitude

  );

    var modelEarth = new AR.Model("assets/earth.wt3", {

        scale: {x: 1,y: 1,z: 1}

   });

var obj = new AR.GeoObject(location, {

           drawables: {

              cam: ,

            }

        });

};

 

 

 

 

 

 
Login or Signup to post a comment