Normally I use Vuforia but i have a question: with Vuforia you can drag/drop by example a sprite on the image marker and position it exactly on the X,Y position you want. When you scan the imagetarget the sprite will be positioned exactly on the X,Y position on the recognised imagetarget.
Is this also possible with AR Foundation Image Tracking? And how can this be accomplished in the Unity Editor?
For customers in the past we used Vuforia to by example show video’s and AR buttons on certain position on a poster and when the user scans the poster all AR elements are shown on the correct position on the poster. I like to reuse this functionality but in this case with AR foundation.
When i now instantiate a prefab it is always in the middle of marker and i like to set the position (x,y) relative on the image target within the Unity Editor.
1 Like
You can modify Tracked Image Prefab and change the position of your model. If you want different positions for different images, you can write your own Image Visualized and change model position from there.
For example, in AR Foundation Samples you can change the position of Plane and it will add shift to all your tracked images.
Cool … thanks a lot . I will experiment with these position options!
Hi, I have the same problem. When I start my app in front of the marker, the relative position of my game object works correctly but if I start with my device in different orientation and then move it in front of the marker I see that the game object appears in wrong position.
If I call reset in front of the marker all works correctly but I think that it’s not the better solution.
With Unity Mars I don’t see this problem.
I now instantiate a prefab directly under the tracked image which is a child of the Trackables GameObject. From there i can manipulate position, rotation and scale from a script on the prefab on Awake. This is working good for me.
Hi
can you provide some images of your environment setup and of scripts too ? like how you arranged the Game objects and set the positioning of prefabs ?
I somewhat partially understood what we have to do it would be really helpful if someone provides some sample images while working on custom prefab and custom images
To instantiate a prefab i use the following code:
var markerGameObject = GameObject.Find(marker.DisplayName);
_prefab = Instantiate(arContentButtonPrefab, markerGameObject.transform);
So first find the marker and the instantiate it.
On awake of the prefab i use code to position the instatiated prefab like:
void Awake()
{
var transformButton = transform;
transformButton.localPosition = new Vector3(positionX, 0, positionZ);
transformButton.localScale = new Vector3(scaleX, scaleY, 0.03f);
}