Blender Spawn points?

I’m currently modeling a village, and as I’m placing trees around I thought it might be nice to be able to chop these trees.

I was wondering if theres a way to search through a loaded mesh in babylon for objects named “spawn” with a custom property type named “tree” then replace those objects with tree instances?

Then I could “cut down” and “regrow” trees in specific places rather than randomizing it and have them clip into the main cabin. :joy:

(I’m using the .babylon exporter

EDIT: I can do this in three.js with:

    if ( === 'spawn') {
                     if (mesh.userData.type === 'tree') {
                           //Spawn a tree

To load custom properties set in blender on an exported mesh…

Do we have something like this here at babylon? While searching I come across old threads asking for it, or something similar. @Deltakosh :sob:

If you know the Blender name, you can reference any mesh with a scene call:

const mesh = scene.getMeshByName('spawn')

You can also tag meshes in export, (not duplicates though with unique values). Do not know how you identify tags once in BJS. Probably need to write your own loop through scene.meshes.

You might be better exporting Blender empties for your purpose. They are exported as meshes with no geometry assigned. There are no tags or other custom properties, but for an empty mesh just use the name to pick one out:

for (const mesh of scene.meshes) {
     if ('spawn') {
          // whatever
1 Like

I was referring to empties, but worded it sort of weird.

I was hoping to use custom properties to define what each empty “spawn point” should have in it’s place, for example if I had a “tree” spawn, or “rock” - etc

But! Your solution should work as long as I keep my blender scene organized with rock.001, rock.002 - and so on?

Either way, thanks for the reply! :slight_smile: