Get mouse wheel value

Hello,

first , thank you for this great online soft you’ve done here :slight_smile:
I’m working on a tiny project, and I wanted to know how can we get the mouse wheel value.
Working with e.wheelDelta (the full code is below) seems to be ok in the editor, but when
we play the project , we cannot get the value of the mouse wheel …
Is there a trick or something to get this ? Thank you for your help !
Best .

var doScroll = function (e) {
// cross-browser wheel delta
e = window.event || e;
var delta = Math.max(-1, Math.min(1, (e.wheelDelta || -e.detail)));

// Do something with `delta`
current = current + delta;
console.log(current);

e.preventDefault();

};

if (window.addEventListener) {
window.addEventListener(“mousewheel”, doScroll, false);
window.addEventListener(“DOMMouseScroll”, doScroll, false);
} else {
window.attachEvent(“onmousewheel”, doScroll);
}

@Hamzah_Alani
@awc95014

i’ve seen it once before a while ago, but the chances of me finding it again is close to zero. i will try to find something that works when i have time.

Ho :slight_smile:
so it seems to be possibly. If you have something to share , it will be marvelous !

Hi ,
It’s really weird cause getting wheel value seems to work inside the editor (i can get value in
the console log when I script) but when I run the animation, nothing happen … Any idea ?

just curious, how did you find the scroll value? and what is it? :o

i guess since the scroll is supposed to zoom in and out the canvas, you have to use something like window.preventDefault() (research that, idk what it is). or you can use the vcam asset and lock the screen. if you don’t know how it works, you can tell us.