浏览代码

keep moving spotlight pointing into x direction

Falko Schindler 3 年之前
父节点
当前提交
bf9bc5d8ed
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      nicegui/elements/scene.js

+ 7 - 1
nicegui/elements/scene.js

@@ -188,7 +188,13 @@ Vue.component("scene", {
         const material = texture_material(texture_loader.load(url));
         mesh = new THREE.Mesh(geometry, material);
       } else if (type == "spot_light") {
-        mesh = new THREE.SpotLight(...args);
+        mesh = new THREE.Group();
+        const light = new THREE.SpotLight(...args);
+        light.position.set(0, 0, 0);
+        light.target = new THREE.Object3D();
+        light.target.position.set(1, 0, 0);
+        mesh.add(light);
+        mesh.add(light.target);
       } else {
         let geometry;
         const wireframe = args.pop();