Tried search, but couldn't find anything.
I want to destroy all foundations and stone walls within a set radius of a location.
Destroy all player built entity's within a radius?
Discussion in 'Rust Development' started by Dubz, Aug 7, 2017.
-
Last edited by a moderator: Aug 7, 2017
-
Anyone have any examples of SphereCast that i could have a look at, or knows of a plugin that uses it?
-
Actually you might be better off using this -> Unity - Scripting API: Physics.OverlapSphere
Example:
Code:Collider[] colliders = UnityEngine.Physics.OverlapSphere(new Vector3()); foreach (var entry in colliders) {
-
Code:Vector3 position = new Vector3(x, y, z); float distance = 30f; List<BaseEntity> nearby = new List<BaseEntity>(); Vis.Entities<BaseEntity>(position, distance, nearby); foreach(BaseEntity entity in nearby.Distinct().ToList()) { if (entity.PrefabName.Contains("foundation")) entity.Kill(BaseNetworkable.DestroyMode.Gib); }
Last edited by a moderator: Aug 8, 2017 -
Tkae a look at my Building Blocker for Rust | Oxide - I've switched to another in-game function, but there is 2 examples commented: Using pool and Physics.OverlapSphereNonAlloc. Both can work in your case
-
@CaseMan @Vlad-00003
Thankyou both, i'll check it out. -
-
Thanks for your help!