Start a new topic
Solved

How do I set/fix a 3D model's direction/orientation after image recognition?

Hi,


I have a 3D model (.wt3) of a drain with connecting pipes that I want to overlay on the ground. I have an image marker on the floor that I can use to perform an image recognition to anchor the model using AR.ImageTrackable.


What I then want to do is fix/set the known real-world orientation (i.e. easting/northing, degrees) of the model/drawable at the point at which it was anchored.


I'm fairly new to this, and don't quite understand how to set the correct orientation and fix the drawable in position so the user can move around in free space and view the drawable.


Any guidance would be much appreciated,

Mike


Perfect, that makes sense.

Hey,



if you do know the compass orientation of your physical object, all you would need to do is apply a constant rotation in Y, as you've correctly said, to the 3D model. The code for this is the following


var model = new AR.Model("my3dModel.wt3", {
  rotate: {
    x: <X>,
    y: <Y>,
    z: <Z>
  }
});


where <X>, <Y> and <Z> are numbers in degrees, positive values rotating counter-clockwise, if I remember correctly.


As for finding out the amount of rotation required, you could either have a look at your WTO file in Wikitude Studio to inspect the exact coordinate system contained within, or, more simply, find the correct value through a couple trial and error iterations, honing in on the orientation you'd like to have, i.e. east.


For example:


If your physical object always points north, and your tracking map happens to have a rotational Y offset of 90° (your augmentation would point to the west), you would need to apply a constant Y rotation of -180° to your model for it to point east.


Does that make sense?



- Daniel



*EDIT*: WTO file of course, not WT3 file.

Morning Daniel,


For the first question I will know the compass orientation of the physical object. And for the second, I'm not restricted to a particular SDK, I am using the iOS Javascript SDK but I could use a native one.


Essentially I'm trying to put together a quick demonstrator hence why the SDK is less critical at this stage that I can show to my company bosses that Wikitude has the capability to do what I describe above.


Mike



Good morning Mike,



unless you know the compass orientation of your physical object, I don't think you can do that with the JavaScript SDK. Object tracking is oblivious to compass and provides you with a coordinate system that is entirely dependent on the object target. Since we do not provide the underlying tracking matrix in JavaScript, I don't think there's a way for you to apply a compass orientation in a meaningful manner.


If you were to use the native SDK, however, you would, I think, be able to ignore the rotational part of the tracking matrix and just apply the translation, allowing you to simply apply the compass rotation on top of that.


So, the two essential questions are:


Do you know the compass orientation of your physical object?

Would it be possible for you to use the native SDK instead?



- Daniel

...so I'm talking about setting the Y-axis of the model to a real world compass point.


Mike

I guess in more simple terms, imagine I use object tracking to overlay a model of a person, but I want the model of the person to always face East (i.e. 90-degrees from True North). How do I indicate to the 3D model that the person should always face East when the overlay is rendered.


Mike

Sorry I think my terminology is a bit wrong.


So I am able to detect an object using object tracking (i.e. like the fire truck example in the SDK).


So say for example the object is a fire hydrant. I am already able to successfully detect this object and overlay a 3D model (.wt3). The problem I have is I want the overlay (which is an overlay graphic showing the underground pipelines that connect to the fire hydrant) to be orientated so that it maps to the physical position of those underground pipes. The thing I don't understand is how I tell the 3D model overlay to be orientated into a fixed known real-world direction (i.e. in degrees?).


Mike



 

Hey,



I'm not sure you can actually do that with our SDK. The problem being that you would need, after the initial image recognition, switch to instant tracking to be able have a mapping of the environment. I'll think about this some more, but I'm pretty sure the is no way to do this currently.


Is the Image recognition an essential part of your application? Do different things happen for different images? If not, I suspect what you'd really want it either instant tracking or object tracking.


Maybe you could describe your use-case in detail for me to be able to make a suggestion? If you have a physical object you'd like to have augmentations on, object tracking seems to me to be the likely candidate.



- Daniel

Thats correct Daniel. But once it is 'fixed' to the point at which the image was recognised, it's unclear to me how I set the correct orientation of the model to map to the real-world orientation of the physical object..in this case a series of underground pipes.


Mike

Hi Mikey,



do I understand correctly, that you want to, after having recognised an image and placed a 3D model on top of it, have the model stay at this exact position without being tied to the image target? Such that you could remove the image target and still have the model in the same spot?



- Daniel


Login or Signup to post a comment