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;
Solved Check that the object on the building block
Discussion in 'Rust Development' started by Sanlerus, May 28, 2015.
-
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; }
-
Thank man!