首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >awe.js增强现实添加文本

awe.js增强现实添加文本
EN

Stack Overflow用户
提问于 2016-12-07 23:47:40
回答 1查看 837关注 0票数 2

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

代码语言:javascript
复制
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'});

然后我对这个主题做了更多的研究,并尝试了不同的方法,但仍然没有成功。

代码语言:javascript
复制
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' });
EN

回答 1

Stack Overflow用户

发布于 2016-12-18 20:53:54

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

代码语言:javascript
复制
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 

希望这能有所帮助

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41021703

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档