Unity AR Foundation object anchor problem - unity3d

I am new on unity ar foundation and I am trying to create simple screen that when camera looks to the target image, my object will be visible at that point and some other objects will be visible according to first object position (referans point).
When camera looks the target image, my object becomes visible but when I move camera, object also moves with camera direction as well like that; check here to see video
What can I do to keep object always at the same point even camera moves (even it can be render once -no update-).. any advise ? Thanks

Which AR platform do you working on? (ARKit & ARCore) You don't need an anchor if you use the tracked image. Because it is already an anchor. Update your game object transform if only if tracked image anchor tracking state is tracking & limited. Also the image you provided has few trackable features. You should test your code with an image that has more features than the current image. Also setting the image's physical size correctly greatly improves tracking.

Related

ARkit - go inside house (3D walkthru)

I'm trying to use ARkit to create a simple demo where I would need to scan an image and display a 3D model of the house at the exact location defined by the image. This means that the picture would be the starting point 0 for me, and from this point I would show the house to which I could go in augmented reality. Is there any way to do this?
I came up with the method using image tracking, but I can't fix the position of the scanned image, the model always disappears when the mobile phone does not see the image.
My question is.
Is it possible to fix the position of the object after scanning the image, even if the phone will no longer point at it and can I walk 20 meters further?
Thanks for any help, I'm new to ARkit features.
I have a similar issue.
I recommend you use the method of cloning an object to the same location with 'Instantiate' after image tracking.
Or, I think it would be okay to utilize AnchorContent(position, prefab) by Anchor Manager.
Anchor Content Method
Then, Even if you don't see the image, the model won't disappear
My model doesn't disappear after image tracking, but when I walk 20 meters more,
The problem is that the position of the object changes slightly.
After solving your current problem, I would appreciate it if you could let me know if the position of the object is fixed well.

HoloLens companion map

I am implementing a "companion map" for a HoloLens application using Unity and Visual Studio. My vision is for a small rectangular map to be affixed to the bottom right of the HoloLens view, and to follow the HoloLens user as they move about, much like the display of a video game.
At the moment my "map" is a .jpeg made into a material and put on an upright plane. Is there a way for me to affix the plane such that it is always in the bottom right of the user's view, as opposed to being fixed in the 3D space that the user moves through?
The Orbital Solver in MRTK can implement this idea without even writing any code. It can lock the map to a specified position and offset it from the player.
To use it what you need to do is:
Add Orbital Script Component to your companion map.
Modify the Local Offset and World Offset properties to keep the map in the bottom right of the user's view.
Modify the Orientation Type as Face Tracked Object.
Besides, the SolverExamples scene provided by the mrtkv2 SDK is an excellent outset to become familiar with Solver components

How can we track face in AR foundation (ARKit3) but not show front camera to the device screen?

Basically, there is a problem with ARFoundation package in Unity3D.
At first, I generate avatar model from the AvatarSDK. Not really important at this problem. but anyway. It returns skinned mesh renderer with blendshapes.
What I want to do next is to control those blendshapes with my own face through front camera. For this, on my scene I loaded ARSession/ARInputManager, ARSessionOrigin/ARFaceManager.
Then, when by model is generated, I enable ARFaceManager component to track face.
What I see next is front camera image with my virtual model on it.
The problem is I need to track face by front camera, but I do not want to see front camera image on screen.
Can it be solved?
In order to do this, you need to create a new skybox cubemap material first.
After you've done so, navigate to AR Session Origin > Main Camera in your hierarchy and find the AR Camera Background component.
Click the Use Custom Material checkbox and load your newly created skybox material as the custom material.
This will override the default camera material setting.
Good luck!

ARKit: Change FOV for rendered content

I'm looking to change the field of view for the rendered content in my AR session. Obviously we can't change the raw camera FOV, but I think it should be possible to change the field of view for the rendered SceneKit content.
Changing the camera field of view is trivial in a raw SceneKit SCNCamera... but I don't know how to do this within an ARSCNView.
You might be able to access the pointOfView property of your ARSCNView (and then retrieve the active SCNCamera).
If that doesn't work (ARKit changing the camera property every frame etc.), you can always go the path of writing the code yourself by using ARSession directly with SCNView.
Note that unless you have a 3D scene covering the entire camera stream, changing the FoV of your virtual camera would break the AR registration (alignment).
The developer documentation for ARSession suggests "If you build your own renderer for AR content, you'll need to instantiate and maintain an ARSession object yourself."
This repo does this: https://github.com/hanleyweng/iOS-ARKit-Headset-View
This code will retrieve the camera from an ARSCNView if there is one:
sceneView.scene.rootNode.childNodes.first(where: { $0.camera != nil})
Note that this will return the camera's associated node, which you may need if you want to control its position or angle directly. The SCNCamera itself is stored in the node's camera property.
It's best not to touch the AR camera if you can avoid it as it will mess up the association between the world model and the scene. I occasionally use this technique if I want a control system that can optionally use AR to track device motion and angle, but which doesn't have to translate into real-world coordinates (i.e. VR apps that don't display the camera feed).
Essentially, I'd only do this if you're using AROrientationTrackingConfiguration or similar.
EDIT I should probably mention that ARKit overrides the camera's projectionTransform property, so you probably won't be able to set fieldOfView manually. I've had some success setting xFov and yFov, but since these are deprecated you shouldn't rely on them.

Keep object in place when AR track is found

I'm pretty new with Vuforia and Unity, what I'm looking for is to have a full-screen/in place image/object (without movements) when the track is found (in keep it on screen till track is lost)
I was thinking to make the image target child of AR camera (to keeps is relative position to the camera) and put my image on top of it (a sample cube for now).
This will give me the correct positional result (image is not moving) but there are some rendering issues. (when I run it, it's blinking as I guess could be some rendering issues)
any comments and suggestions would be really helpfull
The way vuforia works is that the camera is manipulated so that it has the same relative position to the target as your device has to the physical target in the real world.* Making one the child of the other won't allow this to happen. The whole point is to replace the "marker" with the 3D object so that it looks like it actually exists in the real world, moving and keeping itself fixed in place as the user moves their device around.
If you want something to be displayed on screen relative to the screen you should have it check to see if the target is detected and enabled, and depending on that state, enable or disable itself. This object can then be a child of the camera (so it doesn't move).
*Alternatively it moves the object around relative to the camera.