本文整理汇总了TypeScript中THREE.Vector3.unproject方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Vector3.unproject方法的具体用法?TypeScript Vector3.unproject怎么用?TypeScript Vector3.unproject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类THREE.Vector3
的用法示例。
在下文中一共展示了Vector3.unproject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: store
const onDocumentMouseDown = (event) => {
let state: State = store().getState()
let scene: THREE.Scene = getScene(state)
let camera: THREE.Camera = getCamera(state)
let renderer: THREE.Renderer = getRenderer(state)
event.preventDefault()
mouse.x = (event.clientX / renderer.domElement.width) * 2 - 1
mouse.y = -(event.clientY / renderer.domElement.height) * 2 + 1
let vector = new THREE.Vector3(mouse.x, mouse.y, 0.5)
vector.unproject(camera)
let dir = vector.sub(camera.position).normalize()
let distance = -camera.position.z / dir.z
let pos = camera.position.clone().add(dir.multiplyScalar(distance))
pos.z = 250
store().dispatch({
type: 'MOUSE_DOWN',
pos: pos
})
}