player parent is killed when sword child hits enemies
I have it coded so that when the player hits the enemy, he dies. Simple. Well, the sword is parented to the player, and when I strike an enemy with it, it counts it as the parent touching the enemy and I die. I assume that's what's going, at least. I literally only need the child to inherit the transform of the parent. Is there a way I can specify that?
Answer by SterlingSoftworks · Sep 02, 2015 at 03:02 AM
Are you positive that the sword is outside of the parent's hit box?
Have you tried assigning tags and handling collisions this way?
Also, which object (player or enemy) handles the object destroying?
Answer by Hydropulse17 · Sep 02, 2015 at 07:26 PM
I am positive, I've triple checked, plus I can swing all I want as long as I don't hit the enemy. Even striking the checkpoint flag with the sword makes the checkpoint active. Each object's script handles collision in it's own script. That is, the player script is coded to destroy the player on contact with the enemy, and the enemy script is coded to destroy the enemy on contact with the sword. Is that not the best way to do things? I don't know how to detect the collision of one object with another from a third object, but I could learn.
Your answer
Follow this Question
Related Questions
Getting Parent object from a child's collision. 1 Answer
OnParticleCollision() on parent script, for a child particle system? 2 Answers
destroy other child objects when the parent counts more than 1 child 1 Answer
Instantiating as a child of an object in hierarchy 1 Answer
Moving grabbed object OnTriggerStay2D 0 Answers