Replies: 1 comment 3 replies
-
hi @carlreid - sorry for late reply - I have been AFK for a week. What is happening is that your transform node is created immediately and then the Let me know if that helps (the hook is throwing a promise, which is caught in the |
Beta Was this translation helpful? Give feedback.
-
Before using
react-babylonjs
, I was loading in models using something like below, to essentially change the pivot point of any mesh that is loaded in, so any mesh would be properly centered. I am trying to replicate it withreact-babylonjs
.Before:
After (in
react-babylonjs
):What I have observed at leas, is that
console.log(transformNode.getChildren())
outputs an empty array, when I would have expected the loaded model to be in there. I can see in the inspector window that the model is in the transform.Maybe
onCreated
is far too early and I should perform that logic elsewhere, but didn't find where this could be yet. I also suspect thetransformNode.scaling.setAll(1); // Set scale to 1 to fix above.
part is just because thenormalizeToUnitCube
is working on no content, so it normalizes to0,0,0
as there aren't any descendants.Where should I essentially "hook" into any change events of content in the
transformNode
to be able to re-calculate a pivot point? There seems to beonAfterWorldMatrixUpdateObservable
(doesn't provide types in TS) andonReady
(provides justnode: Node
).Update 1
I have observed that the
transformNode
's children does indeed become an array of 1, if I make a change and save, which causes a re-render I guess. So I guess this has something more to about the state not being updated somehow?I'm now attempting to
useState
the transform node, and when the model loads. Still doesn't work completely, but feel like it's closer to a solution.Beta Was this translation helpful? Give feedback.
All reactions