Log in or register to post comments

Normal of the ImageTarget object?

December 19, 2010 - 3:47pm #1

Does anyone know if it's possible to get the normal of the ImageTarget "plane" object? It has a MeshFilter component built in, so I presume that Unity would treat it like a plane..

When I try both MeshFilter and gameObject.transform.up, it looks like the normal vector does not change, even if I move the image target's orientation (in the real world).

Re: Normal of the ImageTarget object?

December 22, 2010 - 12:26am #6

@ksiva - Ack.. So basically, the user's device has to be absolutely stationary (not held in quivering hands). I think the complication with movement from the camera + targetobject in the posemode set to target might have been causing the weirdness.

Right now, I'm just trying to create simple toy projects to test out some ideas -- say, using the marker/imagetarget as a paddle for a virtual ball (paddleball, AR -- with or without the string tied up).

It's easy to get that to work for Unity Desktop, as there's even a built-in bounce physics material, but the same thing looks like chaos (well, okay, *not* mathematical chaos, but it just doesn't behave as expected).

Tracking the normal vector of the plane "paddle" with a GUIText (Debug.Log or Unity Remote does not work yet), and it seems the ball just doesn't react to it (usually doesn't even bounce before losing touch!)

@paulius - unity's great and startlingly easy to pick up! i finally activated my pro trial, just started with it last week, after hours - already starting to fumble around and do... quasi-stuff with it!

Re: Normal of the ImageTarget object?

December 21, 2010 - 9:11am #5

Hi ina (I have seen you on UnityAnswers a lot lately ;))

gameObject.transform.up should be the one that you're after, but I don't know why it doesn't work for you - maybe something (QCAR for example) is overriding position of your target object.

Re: Normal of the ImageTarget object?

December 21, 2010 - 6:53am #4

What exactly are you trying to do?

If you set the ARCamera Pose Type to Target, then the target will be moving in relation to the camera, changing both its normal and its direction of gravity. Note that moving the target and moving the device will have the same effect, so it will be difficult to use just this information to determine the target's true direction of gravity (in terms of the real world). For that, you need to also use the device's acceleration values (from the accelerometer) to find its direction of gravity. Then you can do some math to determine the target's true (real world) direction of gravity. Getting a stable value using this method isn't trivial, however, as the accelerometer is typically pretty noisy. You'll need to add some filtering to get a nice constant gravity vector for the device.

I may have completely misunderstood your goals here, however, so again let us know what you're trying to accomplish :)

- Kim

Re: Normal of the ImageTarget object?

December 20, 2010 - 10:42pm #3

It looks like setting the pose type to target on the ARCamera leads to some unexpected results (compared to desktop, pressing the play button), even using just a single built-in rigid body sphere with gravity enabled (default) to "interact" with the physical meshfilter Image Target plane. :(

I suppose QCAR Unity wasn't designed for treating the AR ImageTarget as a plane, to be used for physics interaction with other objects? Or - are there some optimization tricks we should be aware of?

Re: Normal of the ImageTarget object?

December 20, 2010 - 6:31am #2

There is a setting on the ARCamera that applies here. The Pose Type can be set to either Camera or Target. When it is set to Camera, the tracking pose is used to move the camera in relation to the target. The target stays stationary while the camera moves around it (thus the target normal wouldn't change).

If you set the Pose Type to Target, then the camera stays stationary while the target moves in front of it. Then you should see the normal of the target changing.

- Kim

Log in or register to post comments