Quantcast
Viewing all articles
Browse latest Browse all 565

How do I make and object fall through the floor after a specific time?

When I kill the enemy NPC, I instantiate a ragdoll gameObject with this script attached. I need the ragdoll to fall through the ground after a second, then destroy itself a second later. I have made a new layer, called "Nocollide." It is layer 10, and in the matrix is set to not collide with any other layers. After it instantiates, I look in the inspector, and it does change the layer to Nocollide, but doesn't fall through the floor. When I walk into it, I collide with it. If I make the prefab's layer to Nocollide before I press play, it falls through. I don't understand why it still collides. Please help. Thank you in advance! Here is my script: void Start () { Destroy(gameObject, 2); StartCoroutine(FadeAway()); } IEnumerator FadeAway() { yield return new WaitForSeconds(1f); gameObject.layer = 10; }

Viewing all articles
Browse latest Browse all 565

Trending Articles