Exercise 8 - Adding a Liquid

In this exercise we'll add a swimming pool to our level.

Building the Pool

Draw a 3" by 4" rectangle on the ground near the end of the long corridor, and pencil off four 1/2" slices from the sides. Pull an extension out from the corridor to meet up with it. Use the Push-Pull tool with the Option key to pull everything up to a height of 1".



Before going any further, check the underside, as some of the faces may be the wrong way up. If so, select them and choose Reverse Faces from the contextual menu.

 

Open it up and delete all the interior faces.



Pull the centre area down a distance of 3/4".



Apply some textures.



You may want to export and play the map now to check that everything is as expected. You should have a nice, empty pool, waiting for some water to go in it.

Adding the Water

Open up Objects.skp and copy the blue cylinder into your model. This is another placeholder object, this time for a liquid. Take a look at it in the Components window and you'll see its description is set to *Liquid.



The horizontal position of the liquid object doesn't matter, but the height of the liquid is determined by the position of the top of the liquid object. Move it downwards until the bottom of it is in line with the bottom of the swimming pool. The object is initially 1/2" high, so that will bring its top 1/4" below the top of the pool.



Select the cylinder and choose Plugins>Marathon>Object Properties. Set the name of the liquid to "Water".



Now select the bottom face of the pool area and bring up the Polygon Properties. Set the Liquid to "Water".



Export and play the map, and the pool should be full of water!

Swimming isn't recommended, since if you jump in the pool, you won't be able to get out. Adding some steps leading out of the water is left as an exercise for the reader. Remember to set the Liquid of all the step polygons that you add to "Water" as well.

Water Effects

The water sounds good, but it looks a bit static -- it could do with some ebb and flow.

Flow

You can give the water a current by entering a value for the Flow Speed in the Liquid Properties window, in world units per second. The direction of flow is controlled by the orientation of the liquid object, as indicated by the arrow on top.

Tides

We can use a light to control the tide level of the water. Add another Light instance from the Components window. Open its Object Properties window, set its name to "Tide", and fill in the values below.




When a light is used to control the height of a liquid, intensities of 0.0 and 1.0 correspond to the bottom and top of the liquid object respectively. So with the liquid object positioned and sized the way we have it, a range of 0.75 - 1.0 should make the water bob up and down just near the top of the pool.

Select the liquid object again, open its Object Properties, and set its Tide Control to "Tide".



Export and play the map, and the water should now be gently rising and falling, and if you've set a flow speed, it should also be flowing in the direction you indicated

Lighting

Another trick you can try is setting the Liquid Light field of the pool's Polygon Properties to "Dim". This will make the surface of the water dimly lit when the lights in the corridor are out, even if the rest of the room is bright!

In Exercise 9, we'll add some sounds to our level.

---