Tip: Easy way to add components and colliders to outputs

   3233   3   2
User Avatar
Member
571 posts
Joined: May 2017
Offline
If you want to automatically add Unity components to your HDA's output gameobjects, then you can easily do that by creating a detail string attribute to your geometry with the name “unity_script”, with the value being the name of the component. Multiple components can be specified as well, and these components can be anything from built-in Unity components like Colliders, Animators, etc., to your own custom Components.

Attached is a simple HDA that takes in an input geo, and assigns a BoxCollider component to the output.

More info here: https://www.sidefx.com/docs/unity/_unity_scripts.html [www.sidefx.com]

Attachments:
simple_input_attach_component.hda (26.6 KB)

User Avatar
Member
143 posts
Joined: Oct. 2015
Offline
Hello
This is working well to add component
But how could you set their parameter ,
like if i want to set the box collider height with my own attribute ??

Ben
User Avatar
Member
571 posts
Joined: May 2017
Offline
Currently the easiest way to do this is to call your own custom script and function to add the box collider with the parameters for size. I'd presume for most projects, folks might have their own wrapper components around colliders and other native components anyway.

Or wait until next daily build because I just added support for Houdini box and sphere geometry types to be automatically converted to Houdini colliders with size and centre position. The attached HDA provides an example of using a sphere SOP as render geometry, and box SOP as collider geometry using the “collision_geo” group naming: https://www.sidefx.com/docs/unity/_attributes.html#AttributesGroups [www.sidefx.com]

Attachments:
box_collider.hda (24.7 KB)

User Avatar
Member
143 posts
Joined: Oct. 2015
Offline
Ok , thanks for the answer !
In fact i was looking for adding proceduraly some hinge joint
for doing a procedural Chain asset with each joint automatically joint to the next link….
I have already a custom made chain asset in Houdini , so i was looking to some way to use it in houdini engine
It would be great for simple stuff witch work well with bullet , it could work well also in Unity i think !

I will test your demo file ASAP

Thanks !
  • Quick Links