/// <summary> /// Plants one item /// </summary> /// <param name="scene">Scene</param> /// <param name="pos">Position</param> /// <param name="size">Size</param> /// <param name="res">Resulting item</param> /// <returns>Returns true if an item has been planted</returns> private static bool Plant(Scene scene, Vector3 pos, Vector2 size, out VertexBillboard res) { var ray = scene.GetTopDownRay(pos); bool found = scene.PickFirst( ray, RayPickingParams.FacingOnly | RayPickingParams.Geometry, SceneObjectUsages.Ground, out var r); if (found && r.Item.Normal.Y > 0.5f) { res = new VertexBillboard() { Position = r.Position, Size = size, }; return(true); } res = new VertexBillboard(); return(false); }