HDA: Read primitive attribute from multiparm Unity model

   1587   2   1
User Avatar
Member
8 posts
Joined: May 2020
Offline
Hello,

I'm quite new to Houdini so I apologize for the potential stupidity of this question. However, I wasn't able to find the information after spending hours on Google.

I'm making a HDA for setting up fences in Unity. The HDA accepts a curve and a variety of fence segment prefabs (defined as multiparm) as input. The goal is to randomly instantiate the segments along the curve.

I've managed to get the simple case of instantiating only one prefab running by using the “unity_input_mesh_name” attribute from the model after doing an object merge. However, accessing the attributes from a multiparm seems to work fine when refering to a geometry node inside the same HIP, but causes Unity to crash when using the HDA with prefabs.

This is the VEX code that sets the unity_instance according to a random model_index that was defined before:

int index = i@model_index;
string path = chsop(concat("../fence_model_", itoa(index)));
s@unity_instance = prim(concat("op:", path), "unity_input_mesh_name", 1);

model_index is in the range of 1…

The multiparm models are named fence_model_1, fence_model_2, and so on.

I had to prefix “op:” to the path in order to access the geometry inside Houdini. This is not working though in Unity. What am I missing here?
User Avatar
Member
571 posts
Joined: May 2017
Offline
Could you attach a HDA to this post which I can take a look? Or better yet, please submit a bug to support@sidefx.com with an example HDA for me to reproduce the issue.
User Avatar
Member
8 posts
Joined: May 2020
Offline
Nvm, I've got it working by replacing “chsop” with “chs”. Although I don't quite understand it…
  • Quick Links