Open jacklj opened 4 years ago
@jacklj hey, dude! fixing objects to armarker doesn't need a camera, why do you using that component?
Hey @tomascg2309, I’m not trying to fix objects to AR markers (I’m already doing that successfully) - I’m using ViroARCamera to fix some Viro Components to always be in the same place on the screen, for a Heads-Up Display. However, when I add the ViroARCamera component (as a sibling to the ViroARImageMarkers, not as their parent), all the image marker child objects jump and aren’t directly on their markers anymore.
Thanks!
hey @jacklj I am having the same issue! did you have any luck figuring this out?
hi @JackSoby , @jacklj Have you both resolved this issue
hi @JackSoby , @jacklj HOW TO CHECK TARGET CENTER of view
Hey guys, i faced the same error and had a little work around which made the job: i replaced the ViroARCamera with a simple ViroNode component and set it's position and rotation to the camera's position and rotation. I retrieved those from the ViroARScene with onCameraTransformUpdate
Hey guys, i faced the same error and had a little work around which made the job: i replaced the ViroARCamera with a simple ViroNode component and set it's position and rotation to the camera's position and rotation. I retrieved those from the ViroARScene with onCameraTransformUpdate
hi, would you be able to provide an example? im having exact same issue
I've also noticed that as soon as I render a ViroARCamera component, ViroARScene stops returning the position values from the onCameraTransformUpdate event. The problem described above could be related to this issue.
Everything else (rotation, forward etc.) remain working but the position array starts to return as [0, 0, 0]. This is not happening when I avoid using ViroARCamera.
The workaround described by @LouisOhlow works, but it caused some delay to reposition the element in my case. Anyway for anyone who wants to try it,
1) Save the cameraTransform returned by ViroARScene into a state object, 2) Render your ViroNode as:
<ViroNode
position={state.cameraTransform.position}
rotation={state.cameraTransform.rotation}
>
Environment
I'm seeing this bug on iPhone SE (iOS 13), both when running the app via the Viro Media app, and when building it from Xcode.
Description
When I add a
<ViroARCamera />
to myViroARScene
, it causes objects to shift slightly in position. It causes objects which are children ofViroARImageMarker
s to shift much more.This is even the case when I explicitly set the ViroARCamera's position and rotation to be [0,0,0] (which is, as far as I know, the default). Therefore I'm not sure why it's causing objects to jump to new locations.
I want to use
ViroARCamera
so that I can position a separate object always in the centre of view (ie not placed in the real world). This works, but then all objects positioned in the world jump to different locations. The locations they jump to seem to vary randomly in direction and distance from the marker.Perhaps the mounting of the ViroARCamera component is causing the viewer's camera location relative to the AR objects to change by a random amount?
Reproducible Demo
I've made a video of the behaviour. At around 35 seconds in, I press a button that causes the
<ViroARCamera />
component to be added, and you see the marker objects jump.Video url: https://www.dropbox.com/s/keftpn0mn80cvb2/viro%20AR%20camera%20bug.mp4?dl=0
The code is something like this: