Web XR - Move Tracking not Game Entities

Hi Folks - First Post

Let me start by saying I am loving PlayCanvas. The live editing in multiple browsers and devices is an incredible achievement.

My problem. I have built a game using lots of rigid bodies, collisions and physics. All the gameplay remains focused at the scene origin. The game uses webXR AR. Eventually I plan to use Blippar or 8th Wall, but want to get things working properly before I incur that expense.

I am using the WebXR AR Starter kit with hit test. With this template example when tracking begins you tap the screen and the entity positioner script moves the target object to that position in space and renables it. The problem this presents for me is moving/teleporting everything in my game to this new position. It can be done, but it’s quite cumbersome. I also want eventually to be able to scale the whole game in place so the user can find a comfortable scale to play at. The process of scaling the physics of the game seems like a dead end.

What I would like to do is once you tap to position, rather than move the game, you move the origin of the AR camera tracking to the new position.

I have tried to do this by parenting the AR camera to a handle entity at the scene origin. Then when I tap the screen to position I take the position vector of the target entity and apply it to the camera handle, but inverting the x and y values. This in my monkey brain should translate the whole AR camera movement focusing the camera back at the scene origin, but this doesn’t really work.

Sorry for the over long explanation.

In short can anybody point me in the right direction to adapt the WebXR AR starter kit code such that tapping to position moves the apparent AR cam position so that the tapped position becomes the scene origin?

Any help most gratefully received.