Jquery 如何在Google VR View Web中的鼠标单击中查找热点值(俯仰、偏航)
我想为我的点击360度图像事件计算以下提到的正确值: 以度为单位。上升是积极的。 以度为单位。右边是正数。 半径:/圆形目标的半径,以米为单位。 距离:/目标与摄像机的距离,单位为米 在上面找不到任何东西 请输入以下代码:Jquery 如何在Google VR View Web中的鼠标单击中查找热点值(俯仰、偏航),jquery,html,google-vr,Jquery,Html,Google Vr,我想为我的点击360度图像事件计算以下提到的正确值: 以度为单位。上升是积极的。 以度为单位。右边是正数。 半径:/圆形目标的半径,以米为单位。 距离:/目标与摄像机的距离,单位为米 在上面找不到任何东西 请输入以下代码: <!doctype html> <html> <head> <title>VR Test</title> <script src="https://storage.goo
<!doctype html>
<html>
<head>
<title>VR Test</title>
<script src="https://storage.googleapis.com/vrview/2.0/build/vrview.min.js"></script>
<style>
</style>
</head>
<body>
<div id='vrview'></div>
<script>
var vrView;
window.addEventListener('load', onVrViewLoad);
function onVrViewLoad() {
// Selector '#vrview' finds element with id 'vrview'.
vrView = new VRView.Player('#vrview', {
image: 'https://storage.googleapis.com/vrview/examples/coral.jpg',
width: '100%',
height: '500px',
is_stereo: true,
is_debug: true
});
vrView.on('click', onHotspotClick);
vrView.on('getposition', onGetPosition);
vrView.addHotspot('hotspot-one', {
pitch: 30, // In degrees. Up is positive.
yaw: 30, // In degrees. To the right is positive.
radius: 100, // Radius of the circular target in meters.
distance: 2, // Distance of target from camera in meters.
});
}
function onGetPosition(e) {
console.log('position',e.id);
}
function onHotspotClick(e) {
vrView.getPosition();
console.log('onHotspotClick', e.id);
}
</script>
</body>
</html>
虚拟现实测试
var-vrView;
window.addEventListener('load',onVrViewLoad);
函数onVrViewLoad(){
//选择器“#vrview”查找id为“vrview”的元素。
vrView=新的vrView.Player(“#vrView”{
图像:'https://storage.googleapis.com/vrview/examples/coral.jpg',
宽度:“100%”,
高度:“500px”,
这是真的吗,
_debug:对吗
});
vrView.on('click',onhospotclick);
vrView.on('getposition',onGetPosition);
vrView.addHotspot('hotspot-one'{
俯仰:30,//以度为单位。向上为正。
偏航:30,//以度为单位。向右为正。
半径:100,//圆形目标的半径,单位为米。
距离:2,//目标与摄像机的距离,单位为米。
});
}
功能位置(e){
控制台日志(“位置”,e.id);
}
热点点击功能(e){
vrView.getPosition();
console.log('onhospotclick',e.id);
}
预期结果应该是某个id,其中包含我可以在单击事件时看到“偏航”和“俯仰”值的对象
上述代码的实际结果为:
打开热点单击未定义问题在于脚本标记,我没有添加类型
,这在图像上添加了一个标记