ReactVision / viro

ViroReact: The AR and VR library for React Native 📳💙💛🤍💚
MIT License
1.3k stars 150 forks source link

When using <ViroCamera> objects that is out of camera node are not stable in world position and keep moving when mobile moves #145

Open AmrRazeen opened 2 years ago

AmrRazeen commented 2 years ago

Requirements:

Please go through this checklist before opening a new issue

Environment

Please provide the following information about your environment:

  1. Windows 11
  2. Device OS & Version: Android OS version (8.0.0)
  3. Version: ViroReact 2.23.0 and React Native 0.65
  4. Device(s): Samsung A5 Android 9

Description

When using ViroCamera objects that is out of camera node are not stable on its position that is relative to world coordinates and while moving the mobile (like walking) back and forth (over z axis) the objects keep moving along back and forth and not staying in the real position. *for example: if object is in position [0,0,-1] and I moved with the mobile to the position [0,0,-2]: -the desired result: that the object is now out of view -the actual result: the object keep moving along with the camera and leaving its original position;

note: some other problem that probably relateed -> when using the callback onCameraTransformUpdate on the position property always gives [0,0,0] and never changes.

Reproducible Demo

<ViroARScene
              ref={ref => {
                this.arSceneRef = ref;
              }}
              onTrackingUpdated={(_state, reason) => {}}
              anchorDetectionTypes={['PlanesHorizontal']}
              onCameraTransformUpdate={({position})=>{
                //always return [0,0,0]
                console.log(position);
              }}> 
<ViroCamera active={true} position={[0, 0, 0]}>
      //this box should be moving with camera and that is working correctly
      <ViroBox height={1} length={1} width={1} rotation={[0, 0, 0]} position={[0, 0, -2]} materials={['red']} />
</ViroCamera>

//this box should not move with the camera and stay on position -> (not working as desired)
<ViroBox height={1} length={1} width={1} rotation={[0, 0, 0]} position={[0, -1.5, -3]} materials={['red']} />
</ViroARScene>
AmrRazeen commented 2 years ago

Any help?? i need an answer asap....

waqaskhanroghani commented 1 year ago

Raped the ViroBox in ViroCamera tag then the box move with the camera try it