I'm a super n00b building my first VR app using Unity 2017. Apologies if I'm missing something obvious or lacking a basic skill to solve my problem! But any help would be greatly appreciated!
I'm working on a scene that uses Touch controllers and Local Avatar & OVR Avatar Hand -- it's a simple first person scene in which the player can see her hands, control them with the Touch controllers, and interact with some objects in the scene. I'd like to be able to trigger changes to the hand color during play. Can't figure out how.
So far I've been able to change the hand color by editing
UpdateAvatarMaterial, which is in OvrAvatarRenderComponent.cs. I changed mat.SetColor to a hard-coded color (in this case, blue). You can see where I commented out the original line and then added my change:
protected void UpdateAvatarMaterial(Material mat, ovrAvatarMaterialState matState)
// Only update the material if it's a material we actively created
if (!materialStates.TryGetValue(mat, out cachedState))
// mat.SetColor("_BaseColor", matState.baseColor);
mat.SetColor ("_BaseColor", Color.blue);
What I don't know how to do is use mat.SetColor from a different script. Like, if the hand collides with a snow bank, detect the collision and change the hand color. I'm of course happy to go about this an entirely different way if somebody has a good idea.