0 votes

Let's say I have a "Branch" scene, that holds the 3D representation of a fallen branch. I intend to use 3 alternative meshes for it, having slightly different shapes. From a game logic point of view, the shape of the branches does not matter, so from a coding perspective all the fallen branches should be accessed via the same generic "Branch" scene.

Now I made this work using a Branch scene containing three mesh instances (branch 1, 2 and 3). The instanced Branch scene will only show one of these meshes and hide the other two. It works. But it also feels a bit weird, especially since I intend to use many other objects, not just branches, and each such object would have different mesh alternatives (it is a great way for a game to feel diverse, or simulate procedural-like content).

  • Option 1: Resources
    I initially thought that I can load the different branch meshes as Resources, but that seems only possible for MeshArrays. I usually export my models from Blender in obj, or some other standard model formats. It would be cumbersome to define mesh arrays for each resource.

  • Option 2: Scenes
    The other option would be to create separate scenes for each of the three branches, that I load as (PackedScenes). This seems to me a very Godot like mindset, node hierarchy, I get it. However, this would triple the amount of files in my project. Somehow it also feels silly to define a scene for the sole purpose of containg a model alternative as a MeshInstance.

  • Option 3: What I did, having 3 MeshInstances and showing onle one of them for each Branch node. But this means that every node contains a copy of these other objects that are not displayed. I basically triple my memory usage.

in Engine by (34 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.

Categories