Camera setting


#1

Can I change the position of the camera when the target is visible and when it is not visible in Universal AR A-Frame projects?
When target is seen, AR objects are related to target.
When target is not seen, AR objects faces the screen (like Z.camera in ZapWorks Studio).

Or is there a sample of the following features somewhere?
https://docs.zap.works/universal-ar/a-frame/camera-setup/


#2

I want to do this on universal AR A-Frame SDK.


#3

Hi @k_uchino!

With A-Frame, you can make an object face the screen by adding it as a child to the camera entity :blush:

I had a quick test using our Zappar for A-Frame Image Tracking Webpack Bootstrap example, and found that you’ll have to make sure the position is technically behind the camera if you’re using the default one.

It’ll look something like this:

<a-entity camera zappar-camera>
   <a-box id="box" position="0 0 -3" visible="false">
<a-entity>

There’s a simple standard A-Frame (with no UAR elements) example here:
https://glitch.com/edit/#!/intermediate-trader?path=index.html%3A11%3A6

Because the bootstrap example already comes with visible and not visible events, I’d recommend looking there first; if you have your own custom visible/not visible events, go ahead and experiment!

Have a lovely day,
Fran


#4

Hi Francesca,

Thank you for your reply.
I did it and could understand.

But I have a question.
Even if you use the same object, you have to prepare two for the image target and one for the screen.
Like this…

<a-entity camera zappar-camera>
    <a-entity id="marker-lost" position="0 0 -3" visible="false">
        <a-box class="box" position="0 0 0">
        <a-plane class="plane" position="0 0 -1">
    </a-entity>
<a-entity>

<a-entity zappar-image="#target-file" id="image-group">
    <a-box class="box" position="0 0 0">
    <a-plane class="plane" position="0 0 -1">
</a-entity>

The elements of the two “box” and two “plane” classes are the same.