Three.js object with constant size

无人久伴 提交于 2019-12-23 19:28:23

问题


I'm working on a drawing program and what I need is a THREE.Object3D element that would have a constant size - just like the line has always 1px. In other words, I'm trying to put to the stage an object which size would be always the same to the viewer (so if you got closer to it, it's size wouldn't change). Similar mechanism is with THREE.Line - it's always 1px wide. I need to create a circle (or maybe other shapes also). What's the best way to do that?


回答1:


Sounds like you need to use an orthographic camera -- e.g.

var camOrtho = new THREE.OrthographicCamera(-width/2, width/2, height/2,-height/2, -100,100);

if "width" and "heaight" are the size of your canvas.

Just use that rather than the typical persective camera.



来源:https://stackoverflow.com/questions/14150703/three-js-object-with-constant-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!