Jump to content

GeNa Runtime API


OrdemDevOps

Recommended Posts

Dear @Bryan,

 last time, I was asking a question regarding GeNa pro, namely, about how to put game objects at runtime.

I learned very basic things from YouTube video on this, but the details are missing.

What I want to do is to set also the fixed rotation at runtime for the GeNa spawner.

I only can spawn things but I don't know how to set the fixed rotation via script.

 

 In my video capture at [1], I have a game object just as a blueprint,

I rotate around local y-axis as far as I want, and additionally,

I want to send such rotation value to GeNa spawner eventually

such that the spawned object's rotation also reflects the the player-specified rotation angle.

 

Could you please give me hint on that?

I could not find more detailed documentation on GeNa runtime API.

 

 One more question. In GeNa spawner, there is an option:

- Perform Undo At Runtime [ x by default ].

I am not sure whether this default value changes at runtime,

but at least when I hit the play mode, I am able to delete

a spawned object by pushing Ctrl + Z.

Can I control this behaviour by script?

It is because I want to give the player such capability.

 

Thanks.

Link to comment
Share on other sites

Dear @Manny, thanks for the advice.

 

I wanted to ask two more questions.

Short Video Clip for the Question:    https://youtu.be/TeifpJPnXng

 

You suggested utilising SpawnCall to post-manipulate the spawned game objects. I needed to offer functionality for a player to discard the spawn when the location or orientation of the spawned object is not ideal. For this purpose, I am currently using:

SpawnCall.DestroyEntities();

The name of the method was a little bit confusing. It says "Entities", but I guess that the name comes from the fact that usually, with GeNa a user wants to spawn several objects instead of just one. Otherwise, it should be exactly doing what Unity's Destroy does, looping over the potentially multiple objects that GeNa just spawned, no? As I have no idea what this is internally doing, I was also wandering about potential memory leakage and so on using the SpawnCall.DestroyEntities() method. Could you please give me a comment on that?

 

Secondly, I want to poll the slope check result of GeNa in advance of the GeNaSpawner.Spawn() call such that I can draw gizmos to give an impression of whether the current spawn location is suitable or not for a player. If you look at my video clip, I am drawing gizmos on my own using a slightly transparent cube. When the current mouse position hits a random transform but which is not flat ground, I wish I could use the slope check from GeNa such that I can immediately tell if the fitness is good enough before a player hits the mouse left-click to confirm the spawn. Could you please advise me on which runtime API is relevant for this in GeNa?

I am using in the editor, for instance:

Spawn Criteria
- Check Slope: Range
- Slope Range: 40

 

Thanks a lot.

 

Link to comment
Share on other sites

On 8/8/2022 at 3:36 AM, Manny said:

'Entities' refers to the Objects that were spawned with this Spawn Call. You are sort of correct... It is called Entities because GeNa can spawn things other than GameObjects (i.e, Terrain Trees, Details, Textures, etc).

As for the DestroyEntities question, I would actually recommend calling the 'Dispose' method for your situation. It will ensure any other background memory is released.

image.png

Then you can set the 'spawnCall' variable to null so the Garbage Collector can do the rest of the job.

GeNa doesn't really allow for any Pre-Spawn checks or events. However, a workaround for you would be to be able to perform a 'Sample' using the SpawnerData associated with the GeNa Spawner. This will tell you whether or not it will be properly sampled based on the Spawn Criteria.

To do this, you can actually use the Internal class' method for Sampling here:

image.png

Thanks a lot @Manny, it was very helpful answer.

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...