图标交互
// 引入图标
const textureLoader = new THREE.TextureLoader();
const map = textureLoader.load("/icon/location.png");
let material = new THREE.SpriteMaterial({map:map})
let mesh = new THREE.Sprite(material)
mesh.position.set(0,1.5,0)
mesh.userData = {id:1} // 自定义属性
scene.add(mesh)
// 创建射线监听点击的物体
const raycaster = new THREE.Raycaster();
const mouse = new THREE.Vector2();
window.addEventListener("dblclick",(event)=>{
   mouse.x = (event.clientX / window.innerWidth) * 2 - 1;
   mouse.y = -((event.clientY / window.innerHeight) * 2 - 1);
   raycaster.setFromCamera(mouse,camera);
   let result = raycaster.intersectObject(mesh)
   console.log(result)
})
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇