Got started a bit later than I wanted to today, but I’m happy with the progress I made.
First, I figured out to get the HDR gradient editor to show from the inspector using the gradient usage attribute. That saves me from needing to create my gradients in VFX graph and allows me to edit the particle color on the fly.
Next, I implemented a max distance cutoff for the players. At first, I tried removing players if they got too far away, but that led to a loop where players would get readded because they were still trackable. Next, I tried disabling the player game object, but that also caused issues with the players list and with the mesh combiner.
I realized the simplest solution, which was to take advantage of the camera’s far clipping plane. When the player stepped beyond the bounds, however, the line renderers would stay on screen because of where I placed the distance checker. So instead of the clipping plane trick, I used this logic to make sure a player truly “disappeared” beyond a set distance:
if ((joint == JointType.ShoulderLeft || joint == JointType.ShoulderRight)
&& targetPosition.z > so.maxDistanceFromCamera
)
{
playerConstructor.leftHandState = HandState.Closed;
playerConstructor.rightHandState = HandState.Closed;
foreach (LineRenderer lr in player.GetComponentsInChildren<LineRenderer>())
{
lr.enabled = false;
}
playerConstructor.leftHandCollider.gameObject.SetActive(false);
playerConstructor.rightHandCollider.gameObject.SetActive(false);
}
That did the trick. Hopefully, I don’t need to worry about too many invisible players getting tracked and slowing down the scene. For extra firepower, my next step is to set up the scene on my 4090 laptop.