What is the best way to test if one object is hovering directly above another for x number of frames?
Thanks in advance for any help!
asked Apr 10 '11 at 08:53 AM
Due to there being many objects trying to capture many objects, Vector3.Distance won't work very efficiently,
Collision is too proving costly and erratic,
Location (array) is too confusing to use on multiple levels
this leaves raycast - which is suddenly not working either.
answered Apr 15 '11 at 02:05 AM
Use Vector3.Distance to determine if they are close enough. Or you can attach a sphere to the target object, set it as a trigger and switch off its MeshRenderer. Use that sphere's OnTriggerCollide to detect the condition for capture.
To check if an object is on top of another, I will take the capturing object and use Physics.RayCast to cast a ray down and see if it collides with the point to capture. You can also use the output of RayCast to check if the two objects are close enough.
answered Apr 10 '11 at 03:29 PM