Open Secretmapper opened 5 years ago
@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?
@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 ?
@code-matt
you cannot access it directly anyway. it always involves serialisation.
in case of rotation, this is what happens:
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:
And some more tipps about rotation or changing properties quickly:
Is there a way to access node properties (like
textNode.boundingBox
) perhaps through refs?