8th Wall WorldTracking

Sample projects :PlayCanvas 3D HTML5 Game Engine
Use the following method to reposition the space

var taprecenter = pc.createScript('taprecenter')

// Fire a 'recenter' event to move the camera back to its starting location in the scene.
taprecenter.prototype.initialize = function() {
  this.app.touch.on(pc.EVENT_TOUCHSTART,
    (event) => { if (event.touches.length !== 1) { return } this.app.fire('xr:recenter')})
}

I want to click there, the object is shown there.I’ll just change the code to look like this

var taprecenter = pc.createScript('taprecenter')

// Fire a 'recenter' event to move the camera back to its starting location in the scene.
taprecenter.prototype.initialize = function() {
  this.cameraEntity= this.app.root.findByName('Camera');

 this.app.touch.on(pc.EVENT_TOUCHSTART, this.touchStart, this);
//   this.app.touch.on(pc.EVENT_TOUCHSTART,
//     (event) => { if (event.touches.length !== 1) { return } this.app.fire('xr:recenter')})
}

taprecenter.prototype.touchStart = function (event) {
    if (event.touches.length !== 1) 
    { return } 
    //var point=  this.cameraEntity.screenToWorld(event.x, event.y, this.cameraEntity.farClip);
    var point=  this.cameraEntity.camera.screenToWorld(event.x, event.y, this.cameraEntity.camera.farClip);
    this.app.fire('xr:recenter',point);
   //this.app.fire('xr:recenter')
};

Changing it to this way did not achieve the effect I want, positioning is still not quite accurate, how do I change to do?

Builds: 8the Wall AR Show - PLAYCANVAS

3 Likes

Hi @chuxinhao, seems mostly accurate to me.

But if you are having precision issues maybe try asking on the 8th Wall forums, your Playcanvas code seems correct.

1 Like

There is a projection from screen to world but no hit/intersection test against the detected floor/plane.

Not 100% sure how 8th Wall works but I would think it would give you plane to where it thinks the floor is so you can perform raycasts against it.

3 Likes

brilliant! I was able to view your project without inserting an 8thwall appKey. As it did? I tried to fork worldtracking but it can only be seen by those who have enabled their device with the appKey. Did you add extra code?

It is not accurate for me neither. The thing is that their system doesn’t ask the user to scan/map the environment like other AR solution. The object appears directly in AR the moment it start. I don’t think it can be accurate this way.

Also, the problem is not only the positioning, but also the scaling. When moving backward or forward toward the AR object, the changes in scale are not correct neither.

Here a video of my accuracy: https://youtu.be/6RJ-67R1bP4