Move forward with left click?

How can I assign the moving forward of the camera to the left click?

    scene.activeCamera.keysUp.push(87); // W
	scene.activeCamera.keysDown.push(83); // S

To This >

    scene.activeCamera.keysUp.push(LeftClick); // Left Mouse Click
	scene.activeCamera.keysDown.push(RightClick); // Right Mouse Click

https://playground.babylonjs.com/#8Z0MKW#32

I think this is similar to:

You will have to add event listeners as in the topic’s PG example or customize camera input:

Yea I’ve tried that and other methods already, problem is gravity, collisions don’t work anymore.
Example:
https://playground.babylonjs.com/#8Z0MKW#33

Does this work for you?

I do collide with mesh and get influenced by gravity even on leftclick move.

3 Likes

Ok, I’ve tried editing it and now it works as I wanted. Many thanks for the solution, you’re the best.