First person camera moves smoothly to follow any point we left click on the floor

This is my first time using playcanvas, I am doing interior project. I can not find solution how to move first person camera smoothly based on left click at any point on the floor.

I saw there is an example project provided to do same thing, it is called WEBXR VR LAB, but the camera does not move smoothly like the example I provided (see the video).

Also the second thing is how to show its cursor when we begin play it ? on the webxr vr lab tutorial, the cursor is hidden if we start playing it.

Hi @YahyaNawir and welcome,

You can smoothly move between two positions using a number of ways. One common way is to use a tween to make a smooth transition between two positions. Check this manual page on how to add the PlayCanvas tween library to your project:

Another way is to use a simple vector lerp as is demonstrated in this point and click example:

Most likely in that example somewhere the mouse cursor is locked. You can search for the following line and comment it out:

this.app.mouse.enablePointerLock();

Here is an explanation on what it does:

2 Likes

Hey @YahyaNawir, in addition to what @Leonidas said, if you don’t want your camera moving through solid walls, then you might want to take a look at some pathfinding solution. GitHub - schteppe/PathFinding3D.js: Path-finding library for 2D or 3D graphs is a good open source project, while you can also look at @Leonidas’s pathfinding product.

I was browsing the PlayCanvas Awesome List.

It links to this app:

It seems to be a good example of what you want to do.