Hey all,
I’m working on a project where body joints get instantiated into the scene as they are identified (Orbbec Astra).
I’m trying to write a script that will add each joint as a position “Target” within the multiple position binder. I’m having trouble finding a way to reference this Targets list at runtime. I am on version 2019.2.17f1, vfx graph 6.9.2 and am not sure how to include UnityEngine.VFX.Utility
Has anyone tried this, or have knowledge of how I could do this? Thanks in advance!
Here’s what I have so far:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Experimental.VFX;
//using UnityEngine.Experimental.VFX.Utility - how to include?
public class VFXDynamicPositionBinder : MonoBehaviour
{
public GameObject groupToWatch;
VisualEffect vfxGraph;
// Start is called before the first frame update
void Start()
{
vfxGraph = gameObject.GetComponent<VisualEffect>();
}
// Update is called once per frame
void Update()
{
BindChildrenToVFX();
}
public void BindChildrenToVFX()
{
var i = 0;
foreach (Transform child in groupToWatch.transform)
{
i++;
vfxGraph.SetInt("JointCount", i);
Debug.Log(vfxGraph.GetInt("JointCount"));
//set each child as a target in vfxparameterbinder
}
}
}