How to show +z object (User’s Back) when user rotates camera

I have successfully integrated Viro in my project.

Followed below code and able to put object
#131

As in front of camera it’s -Z and i am getting X and Z

var objFinalPosZ = objPoint.y - devicePoint.y;
// var objFinalPosZ = objPoint.z - devicePoint.z;
var objFinalPosX = objPoint.x - devicePoint.x;
//flip the z, as negative z(is in front of us which is north, pos z is behind(south).
return ({ x: objFinalPosX, z: -objFinalPosZ });

But the issue is i am not able to show the object those are behind my camera view

screenshot_20181025-143147

See in image i am in mid of two object i am able to view the -Z object but not able to view +z objects.
Is there any way i can rerender view if my camera rotates 180 degree.

1 possible answer(s) on “How to show +z object (User’s Back) when user rotates camera

  1. HI @krishanjangir,
    I see what the issue is. To fix the object not appearing when you turn around, you’ll need to billboard it. Billboarding tells the object to always face the camera, this way in doesn’t matter where the camera is, as the object will rotate to face it. In your case, the object is facing away from you when you turn around and therefore is not being drawn.

    It seems like you are you are using a flexview, so for your top most flexview set the transformBehaviors property like below:

    <ViroFlexView transformBehaviors={["billboard"]} .... />
    

    That should fix the object not showing up when you turn around.

    Regarding compass logic, if your device has no accelerometer or orientation sensor I’m not sure currently what can be done regarding orientation.