HowTo/Configure a spline for collisions

From TrainzOnline
< HowTo(Difference between revisions)
Jump to: navigation, search
m
Line 6: Line 6:
  
 
==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 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.
+
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 behaviour for spline meshes.
+
* "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 behaviour being applied.
+
* "collated" is not supported for spline meshes and will result in the default behavior being applied.
  
 
Extract of an example config file:
 
Extract of an example config file:
Line 44: Line 44:
  
 
==Disabling collisions for an entire spline==
 
==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 if this was the case, 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 or often sparse enough to allow large smoke particles to travel through/around them with no visible impact.
+
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.

Revision as of 16:58, 1 April 2015

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 to modern splines (2.9 or higher, 4.1 recommended).

This page describes trainz-build 4.1.

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"
  }
}

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.

Personal tools