Open beauvaisbruno opened 5 years ago
Is this issue resolved?
I am facing a similar issue, same error code in the same file with the same function getJSIEnv, ASSERTION FAILED sVM != nullptr
. My logcat reported it on line 466 however. After finding this thread, I tried commenting out my ViroCamera component, and there was no more crash. Uncommenting the camera component made the app crash again whenever that ViroARScene that it was in was rendered, so I definitely think there is a link there. I also noticed that sometimes my app didn't crash even with the camera component in the scene! It also rendered the scene correctly with camera changes, ie it showed the scene in the right spot if I put the camera ar [20, 0, 20] for example. This means its possible to have the camera function correctly without whatever code in Viro is causing this crash. I can provide logs of my crash if needed.
+1
https://github.com/viromedia/viro/issues/755#issuecomment-634687774 although the workaround for me was to add `{this.state.switchCamera && (
)}`
and set switchCamera to true on componentDidMount()
Has this been solved? I tried: ViroCamera ViroARCamera onCameraTransformUpdate. The cameras crash the testbed upon loading, and when they do work (at random) they are not working with the onCameraARHitTest (as if another camera launches the ray test and not the active camera) Is there any other way to do UI components that move with the camera?
This is how I fixed the crash
Use viroAppProps prop of the ViroXXSceneNavigator to pass camera state value which became true after a timeout
const [camera, setCamera] = useState(false);
useEffect(() => {
setTimeout(() => {
setCamera(true);
}, 200);
}, []);
<Viro3DSceneNavigator
initialScene={{
scene: (props: any) => renderScene(props),
}}
style={styles.f1}
viroAppProps={{
camera: camera
}}
vrModeEnabled={false}
/>
Check the camera value for rendering ViroCamera
{
props.sceneNavigator.viroAppProps.camera ? (
<ViroCamera
rotation={cameraRotaion}
position={[0, 0, 0]}
ref={cameraRef}
/>
) : null
}
Environment
Please provide the following information about your environment:
Description
Crash directly when using ViroCamera as UI constraint.
Reproducible Demo
Complete reproducible demo https://github.com/beauvaisbruno/virobugs/tree/virocamera_crash
Logcat
logcat.log errorLogcat.log object.zip