Three.js 获取立方体的 4 个角坐标? [英] Three.js get the 4 corner coordinates of a cube?

查看:58
本文介绍了Three.js 获取立方体的 4 个角坐标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获得立方体角的 4 个坐标?

How do I get the 4 coordinates for the corners of a cube?

推荐答案

如果您使用 CubeGeometry(宽度、高度、深度)并将立方体放置在某个位置,那么您的八个角位于

If you are using the CubeGeometry (width, height, depth) and you positioned the cube somewhere, then your eight corners are at

position.x + width/2, position.y + height/2, position.z + depth/2
position.x + width/2, position.y + height/2, position.z - depth/2
position.x + width/2, position.y - height/2, position.z + depth/2
position.x + width/2, position.y - height/2, position.z - depth/2
position.x - width/2, position.y + height/2, position.z + depth/2
position.x - width/2, position.y + height/2, position.z - depth/2
position.x - width/2, position.y - height/2, position.z + depth/2
position.x - width/2, position.y - height/2, position.z - depth/2

这篇关于Three.js 获取立方体的 4 个角坐标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆