Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Grab mouse position on terrain chunk and remove the appropriate cube
- Ray ray = Camera.main.ScreenPointToRay(new Vector2(Screen.width/2, Screen.height/2)); //Input.mousePosition);
- RaycastHit hit = new RaycastHit();
- if (collider.Raycast(ray, out hit, 10.0f))
- {
- Vector3 hp = hit.point + 0.0001f * ray.direction;
- int xHit = Mathf.CeilToInt(hp.x) - 1;
- int yHit = Mathf.CeilToInt(hp.y) - 1;
- int zHit = Mathf.CeilToInt(hp.z) - 1;
- TerrainBrain.Instance().setTerrainDensity(xHit, yHit, zHit);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement