Start a new topic

Can I use a 3D model as geo located POI?

Can I use a 3D model as geo located POI?


Hi all. I have search for this question but I didn't found anything. A client wants to create an app with the usual POIs at different location over the city but he needs the marker to be a simple 3D model with an animation when it is selected instead of 2d images.

I've only see 3D objects used with image recognition but never as a POI marker. Is that even possible?. If so, where can I find an example code?

 

Thank you.

 

R.M.

Hello,

Yes it is possible to place 3D models to a GeoLocation as well as to a RelativeLocation. In fact it is the same like adding a geo located Drawable to the cam. Here a code snippet for placing a 3D model to a geolocation (I scale the model down to 20% since it's a quite huge model):

var bb3d = new AR.Model("assets/models/3D-billboard.wt3", { scale: {x:0.2, y:0.2, z:0.2} });
var loc = new AR.GeoLocation(47.77317, 13.069929);
var geoObj = new AR.GeoObject( loc, {
drawables: {
cam: bb3d
}
});

 

You can also add a function that is called after a click on the model:

 


bb3d.onClick = function(object) { alert("3D model was clicked"); };

 


In our code reference you find a detailed description (Models, GeoLocations, RelativeLocations, GeoObjects). You can also have a look at the documentation where you find various examples.

 

Hope that helps,

Christian

 

        



 

 


Thank You Christian. Sorry. I didn't see your answer.

I tried this code, but it's not working. Would be nice if you include one example for 3D and POI 

There could be several reasons why you cannot see your 3d model:


the path to the 3d model is incorrect

the scale of the 3d model is too small/big

check if your latitude/longitude is correct if you're using AR.GeoLocation (you could also use AR.RelativeLocation)

your 3d model is corrupted


Hope that helps,
Christian

Thanks for your reply Christian.

Here is the code i used,  

var world = {

var car = new AR.Model("assets/car.wt3", { scale: {x:0.042, y:0.042, z:0.042} });

var loc = new AR.RelativeLocation(null, -10, -20, -10);

var geoObj = new AR.GeoObject( loc, {

                       drawables: {

                            cam: car

                       }

                   });

};

 

I used  car.wt3 from the example, so I don't think it's corrupted, I used the right path and the scale also looks pretty fine, what do you think the problem is ? 

I forgot to mention the 5th option: check if you have any JavaScript errors. The code you posted contains a Syntax Error. If you execute it in a browser you see the error in the console.

You define a variable but you probably wanted to create a function, something like this:

var init = function(){
var car = new AR.Model("assets/car.wt3", { scale: {x:0.042, y:0.042, z:0.042} });
var loc = new AR.RelativeLocation(null, -10, -20, -10);
var geoObj = new AR.GeoObject( loc, {
drawables: {
cam: car
}
});
};

init();

 

It works now, Thanks a lot !
Login or Signup to post a comment