Assinging multiple prefabs with Houdini

   2729   4   0
User Avatar
Member
10 posts
Joined: March 2018
Offline
Is it possible to assign multiple prefabs using the operator path and these prefabs would be cooked as one inside the digital asset?
I am trying to make a digital asset to scatter multiple prefabs randomly, but when I try to add an object input inside Unity the asset simply redo the work with the nem input.
User Avatar
Member
571 posts
Joined: May 2017
Offline
Yes, it is possible. When you expose an object path parm, it allows for adding in multiple inputs, with an option to merge them as a single object. See https://www.sidefx.com/docs/unity/_inputs.html#ObjectPathInput [www.sidefx.com]

I'm not clear on your second point about the asset redoing the work with the new input. Is only the new input being used and not the previous ones (or merged version)? Could you provide a screenshot of the HDA interface in both Unity and Houdini? You can also debug your HDA after assigning the inputs by using the main menu in Unity (HoudiniEngine -> Debug -> Open Scene in Houdini)
User Avatar
Member
10 posts
Joined: March 2018
Offline
Hi seelan.
I have this system where I randomize the position of a random object. The random object is chosen by a range of inputs provided in a switch. And if I add a new input to the switch it updates the number of objects to ramdmize.


Is it possible inside Unity when I add an new Input, this new input be treated as a new input in the switch?


Because this is what is happining inside Unity. When I add a new input the process is just repeated. Look that the boxex and the spheres are at the same position.


Sorry for my english and Thanks for the reply!!!
Edited by gabhpe - April 25, 2019 08:35:35

Attachments:
01.JPG (393.9 KB)
02.JPG (456.5 KB)

User Avatar
Member
571 posts
Joined: May 2017
Offline
The object merge is indeed merging all your inputs together. You'll need a way to separate them out. There are a couple of ways to do that.

The plugin will automatically create a Primitive-owned string attribute called “unity_input_mesh_name” and set the value of this to the name of the gameobject containing the mesh; you can then use this to separate out the meshes into groups, then instantiate by group name.

Another option is to expose the Number of Objects multiparm on the Object Merge. This allows to specify separate inputs with groups automatically. Then your Copy To Points can be set to use Source Group for instancing.

You can also instance via attribute instancing, which might be easier if you don't need to import the mesh into Houdini. Create a SOP that outputs points only (not polygons). Each point should be assigned a string attribute called “unity_instance”. The values should be path to prefabs or meshes in your Unity Project (e.g. Assets/Trees/tree1.prefab"). In this case, you don't need an object merge since you aren't bringing the mesh into Houdini. Rather, you expose a multiparm File Path or simple string, then assign the parm values randomly to the point attribute.
https://www.sidefx.com/docs/unity/_instancing.html#ObjectInstancers_Attribute [www.sidefx.com]
User Avatar
Member
10 posts
Joined: March 2018
Offline
Hey Seelan! Thanks!!!
I would give it a try. If I have any trouble can I contact you?
  • Quick Links