- Home /
Is there anyway to see if another Object has any Collision?
Hi, this is a question related to this experiment here.
http://hakune.blogspot.com/2014/06/unity-spherecast-vs-meshcollider.html
Let say that I have a Character, and a weaponObject as a Child of Character.
The Problem is, in order to detect whether the Weapon hit anything, I need to Send data from the Character to Weapon, have Weapon Generate specific MeshCollider, then and have it relay the data of what got hit back to the Character.
Instead of doing that, I simply wanted to know what the Weapon hit, via the component on the Character instead.
Can this be done?
Could you tell us how you are checking what the weapon hit? Are you using Raycasts???
Answer by tanoshimi · Jun 18, 2014 at 11:05 AM
As far as I am aware, the only way to use the inbuilt collision system (OnCollisionEnter, OnTriggerEnter etc.) is by calling those functions from a script attached to the same gameobject as the collider to which they relate.
If you want to implement a general script to test "did collider X hit collider Y" for any X,Y, you'll have to write custom collision detection code yourself.