Imagine I have 2 gameobjects
, red plate and apple.
When game start(this is crucial), apple already on red plate(2 gameobjects
already in contact). so if I move red plate, the apple is "parented" to red plate and follow the transform.
How can I do that in Unity3D
? I look at the code Trigger
and Collision
, both of them need to at least a stage that 1 moving gameobject
to collide the other, which I don't have that.
Any idea how to deal with this?
I found the solution: Bounds.Intersect
As in:
var bounds1 = gameObject1.renderer.bounds;
var bounds2 = gameObject2.renderer.bounds;
if (bounds1.Intersects(bounds2))
{
// do something
}
So with this, my problem solved.