问题描述
在我的canvas three.js场景中创建一个连续的每个方向楼层的最佳方式是什么?
What would be the best way to create a continuous-in-every-direction floor in my canvas three.js scene?
THREE.PlaneGeometry到相机位置,以便它与相机一起移动。
Would it be better to attach a THREE.PlaneGeometry to the camera position, so that it travels with the camera.
或者是使用纹理纹理化场景的另一种方式。
Or is there another way of texturing the floor of the scene with a texture.
我有一些麻烦,我的PlaneGeometry的可见性,由于某种原因,我必须离它一定距离看到它。
I'm having some trouble with the visibility of my PlaneGeometry, for some reason I have to be a certain distance from it to see it.
/* Floor */
var geometry = new THREE.PlaneGeometry( 1000, 1000, 1, 1 );
var material = new THREE.MeshBasicMaterial( { color: 0x0000ff } );
var floor = new THREE.Mesh( geometry, material );
floor.material.side = THREE.DoubleSide;
floor.rotation.x = de2ra(90);
scene.add( floor );
打开所有技巧!
推荐答案
我在自上而下的游戏中有一个无限的海底。我将它重新定位到相机的xy坐标(与z保持一定距离)。然后我,以便它看起来地板移动,即使它粘贴到相机。
I have an infinite ocean floor in my top-down game. I reposition it to the camera's xy-coordinates (keeping a distance with z). I then modify the texture's offset
property so that it appears the floor is moving even though it's glued to the camera.
关于麻烦与我的PlaneGeometry的可见性,你可能命中相机的近或远投影平面(距离) - 任何比靠近
或远远远
剔除,即不可见。您可以在相机的构造函数中配置它。
Regarding "trouble with the visibility of my PlaneGeometry", you probably hit the camera's near or far projection planes (distances) - anything closer than near
or further than far
is clipped, i.e. culled, i.e. invisible. You can configure it in the camera's constructor.
这篇关于THREE.JS场景中的结束楼层的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!