【问题标题】:awe.js Augmented Reality adding textawe.js 增强现实添加文本
【发布时间】:2017-04-22 15:31:33
【问题描述】:

我正在尝试向 awe.js 项目添加文本,使用本教程我想出了一个尝试,https://www.sitepoint.com/augmented-reality-in-the-browser-with-awe-js/

awe.projections.add({
    id: 'text',
    geometry: {shape: 'text', text: 'Hello World', font: 'times new roman', weight: 'normal', style: 'normal'},
    rotation: {y: 45},
    position: {x: -5, y: -31, z: -5},
    material: {
        type: 'phong',
        color: 0xFF0000
    }
}, {poi_id: 'marker'});

然后我对该主题进行了更多研究并尝试了不同的方式但仍然没有成功。

awe.pois.add({ id:'fixed_poi', position: { x:70, y:0, z:-250 }, visible: true });
                    awe.projections.add({ 
                      id:'fixed_projection', 
                                geometry: { shape: 'text', text: "My Text", parameters:{font: 'optimer', size: 50}},
                position: { x:0, y:0, z:0 },
                rotation: { x:0, y:0, z:0 },
                      material:{ type: 'phong', color: 0xFFFFFF },
                    }, { poi_id: 'fixed_poi' });

【问题讨论】:

    标签: javascript augmented-reality awe


    【解决方案1】:

    您可以单独创建文本模型(一个 .obj 3D 模型),例如在 Windows 10 的 3D builder 中,然后通过以下方式将其添加到 awe.js:

    awe.pois.add({ id:'jsartoolkit_marker_64', position: { x:0, y:0, z:0 }, scale: { x: 1, y: 1, z: 1 } });
                    awe.projections.add({ 
                                  id:'marker_projection', 
                                        geometry: { path: 'models/obj/example.obj' }, // path to your model
                                        position: { x: 0, y: 0, z: 0 },
                                        rotation: { x: 0, y: 180, z: 0 },
                                        material:{ path: 'models/obj/example.mtl' }, // path to material if you're using one
                                        visible: false,
    }, { poi_id: 'jsartoolkit_marker_64' }); // common point of interest, in this case the marker 
    

    希望对你有帮助

    【讨论】:

      猜你喜欢
      • 2011-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-26
      • 2011-06-15
      • 2012-07-09
      • 1970-01-01
      相关资源
      最近更新 更多