Why is the object visible before the image has been scanned? What I want to achieve is that the object only appears when the image has been scanned, and that it stays on the image even if I point the camera in a different direction. I’m using an iOS phone.
Hi Anders,
The behavior you are encountering, where the object is visible before the image has been scanned, may occur due to the settings configured for the WebXRImageTracking
component.
To ensure the object only appears when the image has been successfully tracked, you should check the following:
-
Set
hideWhenTrackingIsLost
totrue
: This option controls whether the tracked object should be hidden when the image is not being tracked. By default, this is set to true, which means the object will disappear if tracking is lost. -
Use
imageDoesNotMove
if applicable: This setting is useful for static images and ensures that the first few frames of new poses are applied to maintain stable tracking.
Here’s an example of how to set these properties:
const imageTrackingModel = new WebXRImageTrackingModel({
image: "your_image_url_here", // URL of your image to track
widthInMeters: 0.25, // Match the physical marker size
object: your3DModelReference, // Reference to the 3D object to display
hideWhenTrackingIsLost: true, // Ensures the object hides when tracking is lost
});
- Handle the visibility in
onUpdateXR
: Adjust the visibility of the object based on the tracking state within theonUpdateXR
function.
By setting these properties and ensuring you manage the tracking updates correctly, you can achieve the desired behavior of the object appearing only when the image is detected and remaining in place during tracking.
If you have any more details or specific code snippets you would like to refine further, feel free to share! You may also want to consult the Needle Engine API documentation for more detailed properties related to image tracking.
1 replies left - Get a PRO license for more AI replies.
thread_Fr0fEbg7R8paRyJsWp8YGZW0
Reply to this message to continue the conversation
The bot is unfortunately not right here (I think it replied for Android and WebXR, not for iOS QuickLook) –
on iOS, we’re passing files to Apple’s QuickLook viewer, which has its own logic of what to show when.
For image tracking, it will indeed fall back to placing the object without the image when the image isn’t in the view – unfortunately there’s not much we can do about that, as this is what Apple has decided covers the widest range of use cases. If you feel strongly about this I recommend submitting a Feedback item to Apple as well.