HowTo/Configure a spline for collisions
(Created page with "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 functionali...") |
Tonyhilliam (Talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
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. | 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. | ||
+ | |||
+ | This functionality is only available from [[trainz-build]] 4.1. | ||
==Selecting meshes to use for collisions== | ==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 | + | 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 is to only enable collision detection for the relevant meshes. 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 [[%22mesh-table%22_container#collision-data-generation-mode|collision-data-generation-mode]] tag to "disabled". | 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 [[%22mesh-table%22_container#collision-data-generation-mode|collision-data-generation-mode]] tag to "disabled". | ||
Notes: | Notes: | ||
− | * "separate-shape-triangle-mesh" is the default | + | * "separate-shape-triangle-mesh" is the default behavior 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. | * "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 | + | * "collated" is not supported for spline meshes and will result in the default behavior being applied. |
+ | |||
+ | Extract of an example config file: | ||
+ | |||
+ | kind "track" | ||
+ | istrack 1 | ||
+ | trainz-build 4.1 | ||
+ | enable-pfx-collisions 1 | ||
+ | |||
+ | mesh-table | ||
+ | { | ||
+ | track | ||
+ | { | ||
+ | mesh "track.im" | ||
+ | collision-data-generation-mode "disabled" | ||
+ | } | ||
+ | |||
+ | roof | ||
+ | { | ||
+ | mesh "roof.im" | ||
+ | collision-data-generation-mode "separate-shape-triangle-mesh" | ||
+ | } | ||
+ | |||
+ | wall | ||
+ | { | ||
+ | mesh "wall.im" | ||
+ | collision-data-generation-mode "separate-shape-convex-hull" | ||
+ | } | ||
+ | } | ||
+ | |||
+ | ==Disabling collisions for an entire spline== | ||
+ | Some splines as a whole won't have any visible impact on collision detection and should therefore be completely ignored. This is done by setting the [[KIND_Track#enable-pfx-collisions|enable-pfx-collisions]] boolean tag to 0 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 even if this were to happen, the particles would just hit the terrain instead. Turning off collision detection for spline-based grass or bushes can also be a good idea. These are also quite unlikely to be in situations where smoke will collide with them and are typically sparse enough to allow large smoke particles to travel through/around them with no visible impact. | ||
+ | |||
+ | ==Return to Index== | ||
+ | |||
+ | [[HowToGuides|<< How To Guides]] | ||
− | + | [[Category:How-to guides]] | |
− | + |
Latest revision as of 09:13, 17 January 2018
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.
This functionality is only available from trainz-build 4.1.
[edit] 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 is to only enable collision detection for the relevant meshes. 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 behavior 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 behavior being applied.
Extract of an example config file:
kind "track" istrack 1 trainz-build 4.1 enable-pfx-collisions 1 mesh-table { track { mesh "track.im" collision-data-generation-mode "disabled" } roof { mesh "roof.im" collision-data-generation-mode "separate-shape-triangle-mesh" } wall { mesh "wall.im" collision-data-generation-mode "separate-shape-convex-hull" } }
[edit] Disabling collisions for an entire spline
Some splines as a whole won't have any visible impact on collision detection and should therefore be completely ignored. This is done by setting the enable-pfx-collisions boolean tag to 0 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 even if this were to happen, the particles would just hit the terrain instead. Turning off collision detection for spline-based grass or bushes can also be a good idea. These are also quite unlikely to be in situations where smoke will collide with them and are typically sparse enough to allow large smoke particles to travel through/around them with no visible impact.