Jump to content

Get transform information of gameobject spawns without placing in world


westside47

Recommended Posts

I love using Gaia but have recently implemented a spatial hashing algorithm that activates and pools chunks of objects based on the location of the player. I would love to continue to use Gaia to build my worlds but need a way to just get the transform information (rotation, position, scale, etc) of the the spawned items instead of actually placing them in the world. I understand I could loop through after the fact but would love to skip that step if there is any way I can pass in a spawner to the API and get placement positions.

Link to comment
Share on other sites

Hi @westside47 the closest we would have in terms of an API would be using a Spawn Extension: A spawn extension is a resource that you can spawn that allows you to execute code at the moment when the spawner spawns. This was originally designed for adding support for additional tools from other developers. Here is an article that explains how to set up a spawn extension to call a GeNa spawner at each spawn location:
https://canopy.procedural-worlds.com/library/tools/gaia-pro-2021/written-articles/advanced/spawn-extensions-calling-gena-from-gaia-r136/

You could create your own spawn extension that then, instead of regularly putting down the object in question, writes it into your object pool system instead. To do so, you would need to create a script that implements the "ISpawnExtension" interface, then you can put that script onto a gameobject, turn that into a prefab and use this game object as a resource in the spawner.

image.png

If I were you though I think I would rather keep all game objects spawners of Gaia as they are, and then later loop over the already spawned objects: I think it might be easier to keep the spawners vanilla so you can check and tune the spawns with all objects just being visible on the terrain. If you are happy with the results, you can then run the other process that iterates over the spawned stuff and reads it into your pooling system.
Imagine you create some mechanism where the stuff gets written in to the pool right away and you do not get to see the result unless you run the scene again, I would imagine that might make it cumbersome to adjust & tune the spawner settings.

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Tell a friend

    Love Canopy - Procedural Worlds? Tell a friend!
  • Need help?

    We work with some of the biggest brands in global gaming, automotive, technology, and government to create environments, games, simulations, and product launches for desktop, mobile, and VR.

    Our unique expertise and technology enable us to deliver solutions that look and run better at a fraction of the time and cost of a typical project.

    Check out some of our non-NDA work in the Gallery, and then Contact Us to accelerate your next project!

×
×
  • Create New...