AR Android Stencil shader

sure

by user 680853402338721851

by user 680853402338721851

like this?

by user 680853402338721851

on which layer is your cube in unity?

default

by user 680853402338721851

Is your church transparent?

no, it has a Texture and is also on default layer

by user 680853402338721851

oh now its working

by user 680853402338721851

häöööö

by user 680853402338721851

What did you change?

i depoled again and set the church layers to default again even though they were set to default

by user 680853402338721851

ok but it issnt working on IOS right? do you have any work around idea? :slightly_smiling_face:

by user 680853402338721851

It isnt no. For that @herbst🌵 could tell more

Could you describe what you’re trying to accomplish?

I would like to Place a church in AR, but in the real World is a Bridge infront of the Roof. So I try to simulate the bridge with a block so that the church is hidden there.

by user 680853402338721851

It works now on Android with the occluder.

by user 680853402338721851

or is there a way to tell whic object show on the different smartphones e.g. object 01 is for Android and Object 02 is for IOS ?

by user 680853402338721851

yes, you can add a script, that activates an object before it creates the model shown in quicklook, and then it should deactivate the model when it exites quicklook. I can show you an example in 1 sec

by user 743203108271816774

it should be something like this:

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

// Documentation → https://docs.needle.tools/scripting

export class ActiveteinUSDZ extends Behaviour {

    @serializable(Object3D)
    objectIOS: Object3D;

    @serializable(Object3D)
    objectAndroid: Object3D;

    private usdzExporter!: USDZExporter;
    
    onEnable() {
        this.usdzExporter = GameObject.findObjectOfType(USDZExporter)!;
        this.subscribeToBeforeExportEvent();
    }

    onDisable() {
        this.unsubscribeFromBeforeExportEvent();
    }

    private subscribeToBeforeExportEvent() {
        this.usdzExporter.addEventListener("before-export", this.onBeforeExport);
        this.usdzExporter.addEventListener("after-export", this.onAfterExport);
    }

    private unsubscribeFromBeforeExportEvent() {
        this.usdzExporter.removeEventListener("before-export", this.onBeforeExport);
        this.usdzExporter.removeEventListener("after-export", this.onAfterExport);
    }

    onBeforeExport = () => {
        if (this.objectIOS && this.objectAndroid){
        this.objectIOS.visible = true;
        this.objectAndroid.visible = false;
        }

    }

    onAfterExport = () => {
        if (this.objectIOS && this.objectAndroid){
        this.objectIOS.visible = false;
        this.objectAndroid.visible = true;
        }
    }

}

by user 743203108271816774

You can add the component with this script to an Empty in your scene and select your iOS/Android objects

by user 743203108271816774