Getting plane drop position? (C#)
Discussion in 'Rust Development' started by Mekare, Apr 26, 2016.
-
You should be able to go into the available airdrop plugins like that arrow one and search like drop or something, I would get you it but im mobile right now.
-
If you want to get the ground position use thisCode:
void OnEntitySpawned(BaseNetworkable entity) { if (entity is SupplyDrop) var dropPos = entity.transform.position; }
Input the x and z coords in a vector 3 and it will return with the ground heightCode:private static LayerMask GROUND_MASKS = LayerMask.GetMask("Terrain", "World", "Construction"); //Credit: Wulf static Vector3 GetGroundPosition(Vector3 sourcePos) { RaycastHit hitInfo; if (Physics.Raycast(sourcePos, Vector3.down, out hitInfo, GROUND_MASKS)) { sourcePos.y = hitInfo.point.y; } sourcePos.y = Mathf.Max(sourcePos.y, TerrainMeta.HeightMap.GetHeight(sourcePos)); return sourcePos; } -
Thank you. It was very useful
