Get Owner Of Bounds On Intersect
Documentation in on Bounds is almost nothing, a few days ago I asked a question about the following issue but decided to rewrite it because I thought it was a bit confusing.
Lets say I have Object A and Object B and I want to be able to check if their bounds are intersecting.
Object A has a Boolean that if is true will check if it's bounds are touching another object's bounds and if it has a specific component, if it does, do stuff.
For example: (pseudo code)
if(mybool == true)
{
If(ObjA.bounds intersects ObjB.bounds && ObjB.GetComponent<scriptname>() != null)
{
//Do stuff
}
}
How can I check if two bounds are intersecting and get a component of the owner of the intersecting bounds (if possible).
I pretty much need a OnCollisionEnter or OnTriggerEnter event I can check for at anytime and I am sure bounds is the way to go but if anyone has any better ideas I'll accept that answer.
$$anonymous$$aybe the example is bad, we don't know what Object B is until we get it from the bounds, then it should be easy to check if it has a specific script and do stuff. What needs to be found is the GameObject that has the mesh/collider that the bounds of object A is intersecting with so I can get components from the script on object A that is prefor$$anonymous$$g the check.
Answer by ParadoxSolutions · Mar 20, 2016 at 08:13 PM
Decided to use OnTriggerStay for what I was trying to do, I don't think it is possible to get the gameobject from the bounds that the bounds of the script holder intersect.