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!
It all works perfectly!
A million thanks for your time and expertise!!!
by user 908977119781060648
Nice glad I was able to help! Excited to see what youāre building this time
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 ), 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?
by user 908977119781060648