react-native-ar / react-native-arkit

React Native binding for iOS ARKit
MIT License
1.73k stars 139 forks source link

Improved ARSprite #165

Closed macrozone closed 6 years ago

macrozone commented 6 years ago

This change improves the <ARSprite /> component which was a bit laggy before. It uses now a native loop to render its position, rather then serializing back and forth between js code and native code.

<ARSprite /> can render ordinary react views on the scene:

<ARKit.Sprite
        position={{x: 0, y: 0, z:0}}
        // you can now also give it transition duration
        // this makes the sprite more "smooth". We default it to 0.05s which gives good results
        transition={{
          duration: 0.05
        }}
      >
        <Text>This is the origin</Text>
      </ARKit.Sprite>
stoneWeb commented 6 years ago

How do I implement the perspective zoom function of ARSprite? I'm doing an AR Manual project right now. label a picture with a label. so I need a 2d component, but perspective is needed.

react-native-engineer commented 4 years ago

How can I draw line between two 3D points using ARKit.Sprite? I want to draw 2D line between two 3D points.

macrozone commented 4 years ago

How can I draw line between two 3D points using ARKit.Sprite? I want to draw 2D line between two 3D points.

i would suggest to use a Cylinder between two points. I have an old gist showing that:

https://gist.github.com/macrozone/1760a8e978b8f219b757f04fbbd98c0a

and the vector utils: https://gist.github.com/macrozone/d25824762e22a8dedb08ca6ceb59a1fd