I'm trying to have it so that the player walks through a cloth curtain.
There's a sphere collider attached to my first person camera, and a cloth script attached to a prim plane. I'm trying to attach the FPS cam collider to the cloth object at runtime.
I wrote a script that seems like it should work, but it doesn't. No errors or nothing. The script compiles and works, but the sphere collider just doesn't connect to the cloth component. what gives?
public class ClothTest : MonoBehaviour {
private void Start() {
Cloth a = GetComponent<Cloth>();
var ClothColliders = new ClothSphereColliderPair[1];
ClothColliders[0] = new ClothSphereColliderPair(GameObject.Find("First Person Camera").GetComponent<SphereCollider>());
ClothColliders[0] = a.sphereColliders[0];
}
Here is a screenshot of the cloth component in the inspector: