1. Hi guys. How to check the object deployed on the building block?
    [DOUBLEPOST=1432798601][/DOUBLEPOST]
    Code:
    RaycastHit hit;
    Physics.Raycast(barricade.transform.position, Vector3.down, out hit);
    if(hit.collider.GetComponentInParent<BuildingBlock>()) continue;
    
    ?
     
    Last edited by a moderator: May 28, 2015
  2. That'd probably be the easiest method, however I've found that that specific one will sometimes "hit" the object itself, and not the building block.
    Code:
            private bool IsAboveBuildingBlock(Vector3 position, float maxDistance = 1f)
            {
                foreach (var hit in Physics.RaycastAll(position, Vector3.down, maxDistance))
                {
                    if (hit.collider.GetComponentInParent<BuildingBlock>() != null)
                        return true;
                }
                return false;
            }
    That should allow you to more easily detect it. (Set maxDistance to a usable value)
     
  3. Thank man!