我们可以在配置里设置热点,添加hotspots字段,从而创建热点,热点有助于提供更多的交互操作
Hydreigon.ModelViewer.create(document.body, {
"autoStart": true,
"scenes": [{
"pano": {
"url": "https://hydreigon-publish.cdn.bcebos.com/sdk-index/assets/model/textures/01.jpg"
},
"url": "https://hydreigon-publish.cdn.bcebos.com/sdk-index/assets/model/RobotExpressive.glb",
"offset": [0, -10, 0],
"hotspots": [{
"text": "机器人右手",
"position": [-0.013, -0.01, -0.015],
"parentName": "Hand.R_0",
"events": {
"click": {
"type": "highlight",
"color": [0, 0.4, 0.8],
"duration": 1000,
"times": 3
}
}
}, {
"text": "机器人左手",
"position": [0.013, -0.01, -0.015],
"parentName": "Hand.L_0",
"events": {
"click": {
"type": "highlight",
"color": [0.8, 0.4, 0],
"duration": 1000,
"times": 3
}
}
}, {
"text": "机器人身体",
"position": [0, 0, 0],
"parentName": "Torso_1",
"events": {
"click": {
"type": "highlight",
"color": [0.4, 0.4, 0.4],
"duration": 1000,
"times": 3
}
}
}]
}]
});