Height Calculation

When specifying mud coordinates (3d space) such as x=200, y=200, z=0, the 'z=0' means ground level. Thus ground level on mountain range and ground level on a beach will still have z=0.

The term height calculation refers to how ground level is calculated for an object you are displaying in the mud client. Depending on the 'heightcalcuation' attribute in the object and position elements there are different ways ground level is calculated. In the mud client there are usually towns sitting on a terrain therefore ground level will be ground level of the town. Outside the town ground level with will be the terrain level. Calculating ground level in a town is more expensive than just the terrain so if know your object will never be in a town (eg vegetation) you can set 'heightcalculation' to 'withprimary' and the height will always be terrain level. If you have a table in town on the other hand you might set 'heightcalculation' to 'withcollisiondown' and the table will be set as the at the first collision with a point coming down from the sky onto the town.

There are a few other 'heightcalculation's. This includes 'withcollisionup' where instead of the ground level calculated as a collision of a point coming down from the sky onto the town instead it is a point coming up from under the ground. 'Withcollisionup' is the first point where the point is no longer colliding with the town. This type of height calculation is useful in towns with buildings have roofs. If you use 'withcollisiondown' players or objects would have ground level to be the roof.

The other 'heightcalculation' is 'withcollisionupav' which is the same as 'withcollisionup' except instead three points close together are tested going up from the ground. The point that is the lowest is chosen. This stops a player for example jumping up on top of a column if the player walks through the column.

The way 'heightcalculation' is calculated in Shattered World is to use 'withcollisiondown' with towns split up. For example for sengoku town:

<OBJECT name="sengokutown" >

<FREEFORM filename="models\sengokutown.obsp" collision="horizontal" />

</OBJECT>
<OBJECT name="sengokutownground" >

<FREEFORM filename="models\sengokutownground.obsp" collision="verticaldown"/>

</OBJECT>

Here all the roofs and walls are in the 'sengokutown.obsp' file and the ground level is in 'sengokutownground.obsp'. Collision is set to 'verticaldown' so indicates the freeform is part of the ground while the 'sengokutown.obsp' model is only used for horizontal collisions with walls.

Collision triangle configuration
The collisions element of the config file allows some configuration of the height calculation. Collisions with a town (freeform) are calculated with a triangle coming down from the sky (withcollisiondown) or up from the ground (withcollisionup). The width of the triangle is specified in 'rectwidthtip' in collisions and the height of the triangle is 'roomdiff'.