Hi,
I’ve a scene with a first person controller who, at same point, has to pick up and grab an object (namely, a pickaxe). I’ve solved this part creating a child object of the fps controller, initially disabled with this.gameObject.active = false; and when necessary enabling it with the same method.
The problem is that the character should use this pickaxe to destroy some in-game object. I was thinking to use some methods like function OnCollisionEnter(collision : Collision)
{
if (collision.gameObject.tag == “ThingToDestroy”)
{
Destroy(collision.gameObject);
}
}
but I can’t manage in any way to give a collider to the pickaxe, as long as it’s a child of the fps controller, so collisions can’t be triggered by that object. If the pickaxe isn’t a controller’s child, it gains immediately the collider. Is this a bug, or is there a reason, and a way to get things working as I want?
Thanks for the assistance!