buildar / awe.js

The jQuery for the Augmented Web
515 stars 113 forks source link

Awe.js with geolocation #3

Closed silviuvert closed 10 years ago

silviuvert commented 10 years ago

How do you display some Points of Interest (for which you have latitude, longitude and, optionally, altitude) using awe.js?

buildar commented 10 years ago

First multiply the lat/lon values by some multiplier e.g. 100,000. Then just update the poi.s location using those values e.g.

  awe.pois.update({
    data: {
      position: {
        x: lat*100000,
        y: lon*100000,
      },
    },
    where: {
      id: 'my_poi',
    }
  });

Then just update the camera (point of view) position to be your devices lat/lon e.g.

  awe.povs.update({
    data:{
      position:{
        x: position.coords.latitude*100000,
        y: position.coords.longitude*100000,
      }
    },
    where:{
      id:"default"
    }
  });

In plain english you're basically saying "update the default camera setting it's x position to latitude and the y position to longitude".

And once you've made all your updates you need to call

  awe.scene_needs_rendering = 1;

This is because the rendering is optimised so the scene is only redrawn when you need to.

Caliqo commented 8 years ago

Hello! I am trying to make a geo-ar scenario using the geo-ar demo here on Github as a template. I have tried this code as many different way as I can think of, but I can not get it to work. The demo remains with the POIs being relative to the user. It doesn't seem to recognize the switch to fixed positions. Is there an example out there anywhere I can refer to? Thank you!

sebi-b commented 7 years ago

Hey there! I'm also trying to figure out, how to display different locations using the longitude and latitude attribute. But as Caliqo wrote its not working.... Are there any other solutions? THanks!

syc-pad commented 7 years ago

+1

robman commented 7 years ago

Hi @syc-pad this repos is deprecated so please raise any issues over on the new one (NOTE: This is covered in the README at the top of this repos).

There's a range of useful tips from the @awe-media team plus other users on different projection models for geolocation in issue #18.

Plus I'd recommend checking out the https://awe.media platform that provides a simple drag'n'drop interface for creating Locative AR and 360°/VR content.

syc-pad commented 7 years ago

Thank you @robman ! 👍