Comments (3)
@Secretmapper not yet, but that might make sense for that.
usually you "control" all node properties from react, but in this case, its computed. Are there any more properties that should be readable?
from react-native-arkit.
@macrozone for something like position or rotation being updated at 60fps, would it be better to access the native objects this way and avoid RN re-renders for performance reasons ?
from react-native-arkit.
you cannot access it directly anyway. it always involves serialisation.
in case of rotation, this is what happens:
- you update the rotation property of your Ar-Component (e.g. with Animated Library) once per frame (requestAnimationFrame)
- it will serialize these updates and send these to native
- native part will apply the new values to the internal scenekit-nodes
so the scenekit nodes will reflect whats in your react-tree.
But in case the scenekit nodes gets rotated by something else (e.g. physics), then we have a problem, because you no longer know its real rotation (or even position). In this case, you would need some mechanism to get the new properties from scenekit: either a callback onRotation
or similar. or an imperative api to get the current values getNodeProperties
(e.g. getNodeProperties(nodeId, "textNode.boundingBox"), or some api on the node's ref as you suggest. But this will involve serialisation anyway.
Some more thoughts:
- react-native team seems to do some bigger changes regarding js <--> native communication that might help in this case, but i don't know how it will look like.
- something like shared-memory would be the most efficient way, but i doubt that this is possible given the sandbox nature of most js-vms, but who knows...
And some more tipps about rotation or changing properties quickly:
- usually the 16ms timeframe is enough to update, but it leads to more cpu usage than needed. And if the js thread is blocked, you get stutters.
- There is a transition property on ar components, that will use scenekit to change values smoothly to a new value, similar how css transitions work. Use that to smooth things out. You can even experiment with reducing your update-interval-frequency
from react-native-arkit.
Related Issues (20)
- image detection: get image dimensions HOT 2
- ARKit.snapshot() aliasing HOT 2
- ARKit.Model is not working HOT 3
- Running animation on a .scn Model HOT 3
- Refresh app current component HOT 1
- EXC_BAD_ACCESS HOT 2
- no file or directory: PocketSVG HOT 1
- Library not loaded: @rpath/PocketSVG.framework/PocketSVG HOT 5
- Accessing child elements of loaded models (.dae .scn) HOT 1
- libRCTARKIT. a can not find, please help HOT 2
- onAnchorDetected doesn't return the position or the eulerAngles of the image detected
- React/RCTConvert.h file not found HOT 8
- React/RCTConvert.h file not found : Need to improve plugin for works with last react-native version HOT 1
- This package not working on XCode 10 HOT 1
- Example of Clicking Models and manipulating them HOT 1
- Petition to add the following example to the repo
- does this support body detection ? HOT 3
- How to check if anchor (detection image) is visible?
- Use stored locally image
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-arkit.