- Home /
Question by
sonatkaran · Nov 04, 2014 at 09:46 PM ·
collisionparentchildragdoll
Ragdoll Collisions and Parent-Child Compenent Affect
Hi everyone,
Brief:
I have an enemy which has ragdoll for physics
It has children for each limb(LeftArm,LeftForeArm,..etc)
I have a gameobject as a parent "Enemy"
Problem:
I want to change my shooting system in some situations( for exp: bullettime ) because of this I need to calculate collisions on ragdoll parts. How can i get that info ?
If I add a script on "Enemy" how can I provide the working on every child of parent gameobject ?
Basic Shot System :
if (Input.GetMouseButtonDown (0)) {
vRay = transform.camera.ScreenPointToRay (Input.mousePosition);
Rigidbody clone;
clone = Instantiate (bullet, transform.position, Quaternion.LookRotation (vRay.direction) * Quaternion.Euler (0, 90, 0)) as Rigidbody;
clone.rigidbody.AddForce (vRay.direction * shootForce);
Destroy (clone.gameObject, 2);
}
Detecting Collision :
void OnCollisionEnter (Collision col)
{
if (col.gameObject.tag == "Bullet") {
Debug.Log ("I'm Hit with Bullet!");
}
}
Comment
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
Ignore parent Rotation 1 Answer
How to stop child movement due to collision. 0 Answers
Instantiated GameObject collision without script repetition? 1 Answer
Child object not moving with parent 0 Answers