[SOLVED] Why does this spawn an object node graph not work?

Just getting started with the basics, such as spawning objects. It sounds like spawning an object from another file won’t be in Armory until version 0.7, and even spawning from another scene in the same file seems to not be possible (the object selected by the node goes red when switching to another scene). I don’t see what the problem is with having this cube spawn spheres from the same scene when pushing space, though. Right now it doesn’t appear to do anything… (Using 0.6 beta w Blender 2.8) Can anyone see what the issue is?

Screenshot_20190126_185402

Actually you just used the “wrong” keyboard node. There are two versions of it, one has a yellow output (the one you are using) and one has a red output (this is what you want, it’s called On Keyboard). This is because the spawn object node has a red input.

While using the On Keyboard node should make it work, something that you might want to consider is using the transform input.
A transform is the combination of location, rotation and scale of an object. With a transform there is no need for setting the objects location afterwards. The Transform node is located under the Variable tab.

2 Likes

When the game gets exported, each scene actually ends up in its own file, so that is why that doesn’t work. I have an open PR for being able to spawn objects from different scenes but it was put on hold for investigation into Blender 2.8 collections:

That should be able to go into 0.6 I would think if it is still useful.

1 Like

OK, I updated the graph with my interpretation of your suggestions, @zaethan :

…Still not seeing anything when I push space… :thinking:

user-error

You could try attaching the blend, that way we could test it. It looks like it is right.

generator-test.blend (932.5 KB)

Works fine on my end
Maybe it isn’t getting input because the windows wasn’t active then click on window and then try pressing space, that just happend to me now maybe that what the problem might be

1 Like

I am officially a doofus. Tried your suggestion, @BlackGoku36 and it works! Not sure if I should celebrate or facepalm…

2 Likes

Right now it would definitely be useful as it doesn’t make sense to have every object that the game is ever going to spawn sitting in the same scene wasting resources, but just waiting so it can be spawned later.

Later on, sure, it would be great to use collections for this, eg either having one big collection, or collections for spawnable objects for each level and so on.

Question: Would your patch allow for spawning objects that the gamedev has saved in another blendfile, ala the BGE? That’s how I used to work, basically creating a new blendfile for each enemy / player / NPC / level background set etc, and then instancing each into a file which laid out the level design.

So there are a few of things to note. First, you actually can spawn whole scenes using the Spawn Scene node. So if you put your sphere in its own scene alone, you can spawn the scene that the sphere is in to add it to your scene.

Note: If you try to spawn a scene, you have to be aware that it is spawned with an empty root element as the parent of all elements in the spawned scene. This will actually cause problems if you have any rigid bodies in the spawned scene, because rigid bodies don’t work right when they have parents.

If you need help with that I can show you how I deparented my spawned object in one of my scenfewes.

Second, that patch won’t let you manage your project in multiple blends. One way to do that is with linked proxies. I think I may have heard of some problems with them, but I think it has worked for other people so they are worth a shot for sure.

Third, I also have an experimental modding setup that allows for dynamically loading scenes at runtime for desktop platforms which means you can split the project out into different blends and the game can load them at runtime. This probably isn’t what you are looking for, but it could be good to know about.

I know that feeling well. :upside_down_face: I usually do both.

1 Like