Camera First Person, 'Point&Click' Movements

Hello
How to set up the first person camera that all it’s movement is controlled by mouse? I mean that to look around we have to press the left mouse button to move to the particular position we have to click on the surface. Best example will be shapespark cam, just see example projects : https://www.shapespark.com/

Thanks in advance
Greg

Hi @CrimsonKing,

A good starting point is to take a look at the mouse/touch tutorials to familiarize yourself with you touch events/actions work:

https://developer.playcanvas.com/en/tutorials/?tags=mouse
https://developer.playcanvas.com/en/tutorials/?tags=touch

From there you can start working to replace the keyboard event handlers on the first person camera example with mouse/touch controllers. For example left clicking could start moving the camera towards the front direction.

If you would like to move the camera towards a point clicked in world space you should take a look at how raycasting works, to click and pick a world point:

https://developer.playcanvas.com/en/tutorials/?tags=raycast

There is a point and click example too: https://developer.playcanvas.com/en/tutorials/point-and-click-movement/

1 Like