Skip to content

nested projections example

awe.media edited this page Oct 12, 2016 · 1 revision

A POI represents a coordinate system that can be anchored to the real world in some way (e.g. via GPS coordinates or an image based marker). Projections are the virtual objects that are visible when a POI is viewed.

The standard use of awe is to define POIs (Points of Interest) and add one or multiple projections to each POI.

Alternatively, you can also build a more complex structure within the augmented world. A projection can be added to another projection, or to a different object (such as the awe.pov() - point of view).

Defining nested projections:

awe.pois.add({ 
  id: 'poi_1', 
  position: { x: 0, y: 0, z: 0 }
});
awe.projections.add({ 
  id: 'projection_1', 
  geometry: {
    shape:'cube',
    x: 10,
    y: 20,
    z: 30
  },
  material:{ 
    type: 'phong',
    color: 0xFF00ff,
  },
  position: { x: 0, y: 0, z: 0 }
}, { poi_id: 'poi_1' });

awe.projections.add({ 
  id: 'projection_2', 
  geometry: {
    shape:'octahedron',
    radius: 20
  },
  material:{ 
    type: 'phong',
    color: 0x0fc430,
  },
  position: { x: 0, y: 50, z: 0 }
}, { parent: { object_type: 'projection', object_id: 'projection_1' } });

A projection attached to the pov will also move with the pov, when that is updated. This can be used to maintain a certain projection always within the pov viewport and stuck to a specific position, regardless of where the pov is directed.

Adding a projection to the pov:

awe.projections.add({ 
  id: 'projection_2', 
  geometry: {
    shape:'octahedron',
    radius: 20
  },
  material:{ 
    type: 'phong',
    color: 0x0fc430,
  },
  position: { x: 0, y: 50, z: 0 }
}, { parent: { object_type: 'pov', object_id: 'default' } });