How to move object to an inactive layer in game?

I’m trying to figure out how to move an Object I’ve imported using bge.logic.LibLoad() to an inactive layer for future use but what I’ve found so far seems to imply that it’s not possible.

Point me in the right direction?

There is no way to move an object to different layers at run time, if you are finding you need to do this you should put that object on an inactive layer and add it through addObject() or an actuator when needed, even if that means directly after you load the lib.

? This sounds contradictory. I can’t move an object to an inactive layer, but it looks like you’re implying that it can be done directly after LoadLib mid game.

Alternately I’ve been thinking a next best thing would be to LoadLib, make invisible and nix all collisions. Effectively making it inactive.

As far as I can remember you can load meshs without resulting in an active object. That can be used to do replace mesh.

I’m not sure what happens if you load the object and endObject it. Maybe it is still available im memory to be referred to addObject.

I’m not sure about that.

Just another thought: What happens if you merge a scene with inactive objects? Are the still inactive after merge?

When you load a scene using LibLoad both scenes are merged together, so the active objects in the lib are added in as active objects and the inactive objects (objects on invisible layers) are added as inactive.

What you can do is add that inactive object into the current layer, essentially its not moving the object, but rather creating a new instance of that object in the current layer. The original object will still remain inactive. To do this use scene.addObject() after the lib load.

Well I thought I’d already proved out that idea as a dead end. Naturally after reloading the files, rewriting the load script and trying it again the imported objects showed up under inactive objects without incident.

Thanks people. Hard to learn this stuff without someone looking over your shoulder to tell you when your going down a blind alley or missing a turn.