I'm trying to achieve something like this answer to another post, however I have one major difference which is that I'm not using three.js, instead I'm using an x3d object. I want to capture the scroll position and use it to rotate a 3d object diagonally (from current position, towards the bottom left).
This is the jS:
window.addEventListener("wheel", onMouseWheel);
function onMouseWheel(event){
camera.position.y += event.deltaY * 5; // obviously 'camera' isn't defined as it's not three.js, can I maybe replace this?
camera.position.x += event.deltaX * 10;
}
This is the x3d object:
https://pastiebin.com/5fc174a09dc15
(A lot of coordinates in there so had to paste it externally.)
I can control the object zoom by scrolling over the object and I can grab and rotate the object using the cursor, I just need to know how to connect the rotation to jS when the object is an x3d object and not a three.js one, any help would be greatly appreciated.
First I'm no pro and I'm in touch with it since only a few hours ago, but:
find this viewpoint tab and give it an id like
id="mycam"
<viewpoint id='mycam' DEF='CA_Camera' position='-0 -0 0' fieldOfView='0.691'></viewpoint>
then you can add this code into "body", right under the
</x3d>
tab:You can see that when you call the given id, you can change its properties like
mycam.position="0 0 0";
.And it has to be in this vector format like "0 0 0".