Hey I’m new to Unity and C#, and have been trying to solve this problem for a few hours. I want a ragdoll to seperate once it contacts the ceiling.
The ceiling is made of several children under the GameObject “Ceiling.” Each child and “Ceiling” itself has a 2D box collider.
The ragdoll is made of several children (each has a script attached) connected by 2D hinge joints. They also have 2D box colliders and 2D rigidbodies.
Any help would be really appreciated. Thanks in advance.
This is the code I currently have:
using UnityEngine;
using System.Collections;
public class ExplodeRagdoll : MonoBehaviour {
void OnCollisionEnter (Collision col)
{
if (col.gameObject.name == “Ceiling”)
{
Destroy (gameObject.GetComponent());
}
}
}
2239341–149357–ExplodeRagdoll.cs (245 Bytes)