My setup
I have a simple setup with a character spawned from a factory, a persistent inventory and state in a lua module, and two collection proxies for an outdoor area and a house. I’m switching between these two collections with a scene_switcher object the character activates when they walk into its trigger collider.
The issue
I’ve been trying to figure out a good way of spawning the character at specific places when moving between these two collections. When I go to the door of the house from the outside, I want to load the house collection and spawn the character at a specific place in the house. The house has several stories, so the spawn point can be different in the house depending on if the character comes down the stairs or enters the front door. What would be a good way of doing this for my use case?
Possible solutions?
Would it make sense to pass the new x and y coordinates the character should spawn at to the character factory, when the proxy has finished loading the new collection? Could another solution be to spawn the character in the proper place depending on what the last scene was? Maybe using predefined “spawn points”? Or should I just go with collection factories instead, because proxies feel overkill for my simple use case? I’m not sure, and would love some input on this. Thanks!
I’m thinking that passing x,y coordinates or passing a spawn point is in many ways the same thing. When switching scene (indoor to outdoor, upstairs to downstairs etc) you somehow need to pass info from one collection proxy to another. If this info is coordinates or a named location is basically the same thing right?
I feel that collection proxies is a good option to be honest. Collection factories work as well, but you must then make sure to load the assets dynamically to conserve memory. This is always done when you use proxies and collection proxies are created with these larger scene changes in mind, like loading a new level, location or scene (outside/inside etc).
The idea is basically the same maybe. Regarding the spawn points I was thinking of having predefined spawn point objects in each collection. These would then take a message from the proxy loader when a collection has loaded, telling it to spawn a character there if the previous collection was of a certain type, if that makes sense. So, if the previous collection was “floor 2” I would activate “floor 1 from floor 2 spawn point” or something along those lines.
I’ll definitely keep using proxies then because of the memory benefits. That’s about what I gathered from the documentation, but always good to get a second opinion. Thanks!