Game Development Community

Scroll wheel

by USC - IMD student 2 · in Torque Game Builder · 10/27/2008 (4:28 pm) · 1 replies

Can I add scroll wheel functionality in TGB? How?

#1
10/30/2008 (3:31 pm)
The scroll wheel is already supported, simply bind a command to "zaxis", like so:
moveMap.bind(mouse, "zaxis", "onScrollWheel");

The function will be passed a parameter which represents the direction and amount of scroll applied:
function onScrollWheel(%x)
{
...
}

This number may be fairly large, and require scaling down appropriately. For instance, when using this to adjust a magnification factor for a window, we scale it by 0.0005.