When using the built-in orbitControl() function with webGl and p5js you are able to set the strength of the sensitivity in the function (e.g. orbitControl(1,0,1)). This seems to be the only control you get however. Because the left mouse controls rotation around its lookat point, and your right mouse key allows you to pan without rotation. For my game I like the rotation around the lookat point, for which orbitControl is great, but the right mouse button I dislike. Is there a way to disable this somehow? Or is my best option making my own camera with my own controls instead.
You can extend or modify the internal behavior of orbitControl()
to ignore right mouse button interactions. Since orbitControl
is implemented in the p5.js
library, you could copy its source code, adapt it, and implement your own version.
The orbitControl
source is available on the p5.js GitHub repository. Search for orbitControl()
in p5.Camera.js
to see how it works and tailor the functionality
Hi,
why not just thinking simple !?
function orbitControlJustLeftButton() {
// remove Wheel actions
this._setProperty('_pmouseWheelDeltaY', 0);
this._setProperty('_mouseWheelDeltaY', 0);
// Just apply orbitControl on Left Button Actions
if (mouseButton == LEFT)
orbitControl();
}
function draw() {
// ...
orbitControlJustLeftButton();
// ...
}
Cheers
— mnse