AR/VR Buttons Question

import { Behaviour, GameObject, IPointerDownHandler, USDZExporter } from "@needle-tools/engine";


export class ClickToStartARiOS extends Behaviour  implements IPointerDownHandler{
    private exporter: USDZExporter;

    start() {
        this.exporter = GameObject.findObjectOfType(USDZExporter);
    }

    onPointerDown() {
        if (!this.exporter) return;
        this.exporter.exportAsync();
    }
}```

Oooooooo! Fab!!!

THANK YOU!

I’ll try that right now!

by user 908977119781060648

YAAAAAAAAAAAAAAAAY! :partying_face::tada::beers::star::dizzy::star2::raised_hands:

It all works perfectly!

A million thanks for your time and expertise!!!

by user 908977119781060648

Nice :+1: glad I was able to help! Excited to see what you’re building this time :slightly_smiling_face:

Okay, a bit of related feedback…

I’ve been trying out a couple of things and I have actually found a potential use-case for loading an external/pre-existing USDZ rather than going with a USDZExporter-generated one.

Using Blender to create scene assets and then Unity to put them all together, I have a scene which includes a primitive plane that uses a png transparency as its image texture.

The USDZ file format doesn’t particularly like png transparencies (as we’re all no doubt painfully aware :grimacing: ), however it does manage to display them reasonably properly if a material’s blend mode is set to Alpha Clip (with a Clip Threshold of 0.5 or greater) as opposed to Alpha Blend. The bad news is that setting the material up like that (in anticipation of the scene it’s in being compiled for export as a USDZ) often makes the transparent texture look a bit crappy when it’s viewed as a GLB in a browser window or as a GLB in AR.

So, my workaround is to create and export a GLB with its png transparency/material set up as originally intended (i.e. with a blend mode of Alpha Blend) so that it looks good via all the regular ways that people might view it. Then I temporarily edit the material’s blend mode to change it to Alpha Clip and export that version as (or convert the resultant GLB to) a USDZ which can be added to Needle’s ā€˜Custom USDZ File’.

Hope what I’ve described makes sense and that it might prove useful? :slightly_smiling_face:

by user 908977119781060648