Niantic Studio: How to Disable Camera Zooming While Moving in AR Mode?

Hi everyone!
When enabling AR on Niantic Studio, I encounter an issue where the camera is unstable, and as I move, it zooms in and out on game entities excessively, affecting the gameplay experience.
How can I disable the zoom feature when moving the camera closer or further away, similar to how it’s done in Pokémon Go?

Are you able to record a video? This seems like it could be the recentering behavior.

1 Like

Here is an example video: when I move the phone backward, the objects in the game shrink

Hi @GeorgeButler . I’ve uploaded the video. Can you help me with this issue?

Hey! When you’re testing and encountering these issues, are you always using that curtain as the background? It might be that the system is struggling to calculate the tracking positions because the background is too plain. Have you thought about switching your setup to 3D instead of AR, especially since it seems like you’re not really using any AR features?

Hi @GeorgeButler.

  • That curtain is just a random element during the game testing process. We always require the camera-AR to be on when playing the game.
  • As for the AR feature, I only enable it by changing the Type value of the Camera component to ‘world.’ Besides that, we don’t use any other AR features.

Hi @GeorgeButler. My question is whether it is possible to fix the object size when moving the camera closer or further away?
This pokemon go video at 0:08 is an example https://www.youtube.com/watch?v=E7nwr6sA6Es

Pokémon Go can take advantage of more device capabilities since it runs as a native app, so the comparison isn’t entirely fair.

The “zooming” effect you’re noticing is probably due to the AR system trying to re-anchor the experience. Typically, AR experiences are tied to a fixed point in real space, and if that point is missing or shifting, the experience can appear to move around as it adjusts to the real-world scale and surfaces. Try disabling AR by selecting your camera and switching from World mode to 3D mode, and see if that resolves the issue. Let me know how it goes.

Hi @GeorgeButler
I know what you mean. But we’re developing “Game-AR.” Turning off AR - camera will lose meaning of game. When in AR mode, is there any method that can solve this problem?

It looks like you’re aiming to use the camera feed without SLAM tracking. A straightforward solution is to parent the entire scene to the camera, which anchors everything to it. This way, even if the tracking changes, the scene will stay in place and won’t shift around.

Hi @GeorgeButler
Do you mean to fix the camera position based on the certain object in the scene?
The example below illustrates how the camera will anchor to a character in a scene.

import * as ecs from '@8thwall/ecs'  // This is how you access the ecs library.

const {Position} = ecs
const {vec3} = ecs.math

const offset = vec3.zero()
const playerPosition = vec3.zero()

const CameraFollower = ecs.registerComponent({
  name: 'CameraFollower',
  schema: {
    player: ecs.eid,  // Reference to the player entity
    camera: ecs.eid,  // Reference to the camera entity
    offsetX: ecs.f32,  // X offset for the camera position
    offsetY: ecs.f32,  // Y offset for the camera position
    offsetZ: ecs.f32,  // Z offset for the camera position

    isFix: ecs.boolean,
  },
  schemaDefaults: {
    offsetX: 0,  // Default X offset
    offsetY: 8,  // Default Y offset
    offsetZ: 10,  // Default Z offset
    isFix: false,
  },
  tick: (world, component) => {
    if (component.schema.isFix) {
      const {player, camera, offsetX, offsetY, offsetZ} = component.schema
      offset.setXyz(offsetX, offsetY, offsetZ)
      // Set the camera position to the current player position plus an offset.
      Position.set(world, camera, playerPosition.setFrom(Position.get(world, player)).setPlus(offset))
    }
  },
})

export {CameraFollower}

No custom component needed, drag your entire experience to be a child of the camera.

1 Like

I think that’s the only way. Thanks for your support.

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.