MrGVSV / bevy_proto

Create config files for entities in Bevy
Other
239 stars 25 forks source link

Question: is it possible in bevy_proto to predefine an entity reference to a child in a custom structure? #42

Closed rewin123 closed 1 year ago

rewin123 commented 1 year ago

I didn't find an example. I want to make a predefined door structure consisting of a parent (DoorProto, looks like a doorframe) and the door itself, which is a child of DoorProto. Both parent and child have their own gltf meshes. Also it is required to predefine entity in DoorProto on a door.

MrGVSV commented 1 year ago

Have you seen the hierarchy example? Its prototype files demonstrate how to define entity relationships.

However, this only works for entities generated by the prototype. I don't know how GLTF works, but if it contains a sub-entity, then it's not currently possible to define that relationship in the prototype asset. Your best bet there would be to do one of the following:

The first option works okay, but if you can do the latter that would probably be the best solution.

Does that help at all?

rewin123 commented 1 year ago

Oh, I apologize for the very late reply. Thank you, this actually answers to my question and will get rid of the redundant code 😅