I’m testing image tracking and i notice the object that appears after tracking keeps moving with my camera movement. Sometimes gets lost below the tracked Image.
It happens on sample scene too. I want the object to stay for better stability.
Hi Saad Baig,
To stabilize the tracked object in the Needle Engine when using image tracking, there are a couple of properties in the WebXRImageTrackingModel
that you can adjust:
-
imageDoesNotMove
: Use this to make the tracked object stay in one place even if the image is moving. Set this totrue
to ensure that only the positions from the first few frames are applied to the model. -
hideWhenTrackingIsLost
: This determines if the object should hide when tracking is lost. If you want the object to remain visible at its last tracked position, you should set this tofalse
.
Here’s how you can configure these properties in your image tracking setup:
const trackedImageModel = new WebXRImageTrackingModel();
trackedImageModel.image = "path_to_your_image"; // Set your image URL here
trackedImageModel.widthInMeters = 0.25; // Adjust based on your marker size
trackedImageModel.imageDoesNotMove = true; // Keep the object stable
trackedImageModel.hideWhenTrackingIsLost = false; // Keep the object visible even when tracking is lost
// Example of adding this model to the WebXRImageTracking component
const imageTrackingComponent = GameObject.findObjectOfType(WebXRImageTracking);
if (imageTrackingComponent) {
imageTrackingComponent.trackedImages.push(trackedImageModel);
}
By configuring these two properties, you should notice an improvement in the stability of the tracked object related to the image.
If the issues persist, let me know and we can further investigate!
For additional resources, you can refer to the Needle Engine documentation or Samples Repository.
3 replies left
thread_XSPbjyJX3JDNs2daocPCwNMD
Reply to this message to continue the conversation