I want to do this in Three.JS:
我做了向下运动,但是我没有做左右运动。
var boxGeometry = new THREE.BoxGeometry(5, 5, 5);
var boxMaterial = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false});
boxMesh = new THREE.Mesh(boxGeometry , boxMaterial );
var coneGeometry = new THREE.ConeGeometry(5, 5);
var coneMaterial = new THREE.MeshPhongMaterial({color: 0x0000ff , wireframe: false});
coneMesh = new THREE.Mesh(coneGeometry, coneMaterial);
coneMesh.position.y = 10;
var geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 5, 7.5, 0 ),
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( -5, 7.5, 0 ),
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 0, 7.5, 5 ),
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 0, 7.5, -5 ),
);
var material = new THREE.LineBasicMaterial( 0xFF00C5, 2.0 );
var line = new THREE.LineSegments( geometry, material );
group = new THREE.Group();
group.add(line, boxMesh, coneMesh);
group.position.y = 20;
scene.add(group);
我可以向下移动
group.position.y -= 0.08;
if(group.position.y < 1.6) {
group.position.y = 20;
}
那么,有人可以帮我左右移动吗?