jasonChen1982 / three.interaction.js

three.js interaction toolkit, help you built an interaction event-system for three.js, binding interaction event like browser-dom
411 stars 73 forks source link

只有 `mousemove` 事件生效 #29

Closed iDerekLi closed 4 years ago

iDerekLi commented 4 years ago
import * as THREE from "three";
import { Interaction } from "three.interaction";

new Interaction(renderer, scene, camera);
var cube = new THREE.Mesh(
  new THREE.BoxGeometry(3, 3, 3),
  new THREE.MeshPhongMaterial({ color: 0xffffff })
);
scene.add(cube);

cube.on("click", () => {
  console.log("click");
});
cube.on("mousemove", () => {
  console.log("mousemove");
});
cube.on("mousedown", () => {
  console.log("mousedown");
});
cube.on("mouseup", () => {
  console.log("mouseup");
});
cube.on("mouseout", () => {
  console.log("mouseout");
});
cube.on("mouseover", () => {
  console.log("mouseover");
});