HowTo/Configure a spline for collisions

From TrainzOnline
< HowTo
Revision as of 17:53, 31 March 2015 by Gevrard (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Tunnels, bridges, and other types of splines can interact with smoke particles by preventing penetration, which provides a more realistic effect. In order for this functionality to work as efficiently as possible, it is important to correctly configure spline assets.

Selecting meshes to use for collisions

This is generally done on a case-by-case basis and will depend on how the asset was built. If the spline contains several meshes then the most important thing to do is to only include the relevant meshes for collision detection. For a tunnel, this means that the walls, roof and tunnel mouth are likely to be the only relevant meshes. Catenaries, tracks and other slim/flat objects will add little to no benefit and can generally be ignored. The same principles apply to other types of splines.

By default, each sub-mesh of a spline will participate in collision detection by generating a collision object based on the mesh geometry. To override that and exclude specific meshes, simply set the mesh-table entry's collision-data-generation-mode tag to "disabled".

Notes:

  • "separate-shape-triangle-mesh" is the default behaviour for spline meshes.
  • "separate-shape-convex-hull" provides faster collision detection at the expense of accuracy. If the mesh is a concave surface (such as the inner arch of a tunnel), this will not give suitable results.
  • "collated" is not supported for spline meshes and will result in the default behaviour applied.

Disabling collisions for an entire splines

Some splines as a whole won't have any visible impact on collision detection and should therefore be completely ignored. This is done by raising the enable-pfx-collisions boolean tag in the config file of a given spline asset. Tracks and roads are good examples of assets that serve no purpose regarding collision detection, as they are slim and generally positioned directly on the ground. This makes them unlikely to be reached by smoke particles and if they were, they would be caught by the terrain. Turning off collision detection for spline-based grass or bushes can also be a good idea, considering they are also quite unlikely to be in situations where smoke will collide with them.

Personal tools