How do get the ref of the three object? And how to correctly add an entity? #307
Unanswered
eriksachse
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I too am confused with this and can't move the mesh, despite copying directly from the documentation. Beyond that, I would appreciate if the documents would display the typing for the "three". Now it's a bit obscure what it is supposed to be. That all being said, the documentation show this as an example how to use useFrame to move items I wonder if we are confused due to the new 2.0.0 version not matching the documentation? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Haven't been able to figure it out by myself 😅
In the react docs, there is the ref section https://github.com/hmans/miniplex/blob/main/packages/react/README.md#capturing-object-refs-into-components
My first question is: How do I access the ref exactly to move the object in the useFrame? There is the movement component as well in the docs, but this doesn't help, because it just changes the values in the store, right? Should I use the Entity component, get the object, create a ref, create a useFrame for each Entity, apply the ref to the three component and update the values that I get from another useFrame, which is in the crowd simulation or sum? How does the movement component help me with this?
My second question is that it is a little confusing how to correctly add an entity. I can do
const entity = ECS.world.add({ position: { x: 0, y: 0 } })
, but if I do this, while having<ECS.Entities in={ECS.world.with("position", "health")}>
to display all the components with the three value, and then retrieve all entities, it gets back to me twice. I have found workarounds to this, but I feel like there is much more simple solutions to this.Beta Was this translation helpful? Give feedback.
All reactions