create_mouse_click_sensor to detect right button click

22 February 2016 20:13
Hi guys,

is it possible to use the mouse click sensor to detect right button click?
observing the values of the sensor manifold's callback arguments i cant make a difference.

24 February 2016 12:04

You can check the sensor "payload" field. It contains event.which data:
0 - left button
1 - middle button
2 - right button

You should use get_sensor_payload function to get a payload data.
Blend4Web developer
25 February 2016 22:59
Thank you!
15 November 2016 11:13
Hi, I want to realize the same operation.

Please, have you a code example to execute an operation when we right click ?

I'm not familiar with sensor and I don't found example for mouse click sensor. So, I don't know how and where to use get_sensor_payload.

15 November 2016 18:38
You don't need to use the get_sensor_payload.

if you console.log (e) in the mousedown callback for example you can see all of the payload in the console.

e.button = 0 or 1 or 2

if (e.button === 2) {
//do something
17 November 2016 10:07
Thanks Mike, it's very simple like this.
Please register or log in to leave a reply.