To clarify --
There are two types of 'collision' processing here:
1) Static collisions. Static collisions are intersections tested against the baked walkmesh produced by the toolset. Only the walkmesh and the object trying to move (i.e. the creature) are involved in static collisions; the engine doesn't even look at the placeable (or whatnot) that is being 'walked on', just the walkmesh data laid out by the toolset. Effectively, an object that is a static collider is burned into the map itself at baking time; the engine doesn't even look at the original object, just the imprint it's left on the walkmesh as it was baked.
2) Dynamic collisions. Dynamic collisions are performed against collider meshes that are a part of a placeable's model instead of the static walkmesh produced by baking. If the placeable being collided against goes away, then that space can be inhabited by other objects, such as a creature trying to walk by. A dynamic collider doesn't have its associated walkmesh baked into the map at bake time; the walkmesh considers the ground there to be walkable.
Now, if a placeable is flagged as walkable, then the toolset doesn't bake it into the walkmesh and the game engine ignores it for dynamic collision intersections even if the placeable weren't static.
If a placeable is flagged as static and not walkable, then it will behave as though it were a static collider (as outlined above).
If a placeable is flagged as not static and not walkable, then it will behave as though it were a dynamic collider (also as outlined above).
One additional point worth mentioning is that the underlying pathfinding system itself only knows about the walkmesh; it doesn't have any concept of dynamic colliders. When the toolset bakes the walkmesh, what it's actually doing is creating instructions that tell the engine a complete path for how to get from any walkable point in the map to any other walkable point. Now, because dynamic colliders don't get baked into the walkmesh, the pathing instructions baked into the map don't take them into account and thus may lead to objects trying to walk through a dynamic collider.
If the collider exists, this of course fails. There is some basic heuristic based retry logic in the engine to help NPCs 'feel their way around' a dynamic collider like this, but it's not as robust as the baked pathing instructions.
What this means is that relying heavily on dynamic collisions is likely to make objects behave unintelligently in pathing (not to mention causing your players headaches if they try and use click to move). Thus, it's best to use them sparingly, such as when you want to temporarily block a hallway with something that you would like to destroy later on.
Some additional points for the technically curious:
- Static collisions are much faster for the engine to handle than dynamic collisions. In fact, most of the time the engine doesn't have to do anything to make sure that static colliders are honored, because the toolset's precomputed pathing information (created during area baking) always moves objects around static colliders. In contrast, dynamic collisions require comparatively much more expensive mesh intersections if they come up in pathing/movement.
- The difference between a .trx and a .trn file is that the .trx is the baked walkmesh, with the pathing instructions embedded and with static colliders 'cut out' as appropriately. The .trn file doesn't have walkmesh from static colliders merged in. Both files also contain the terrain mesh for exterior areas.
- Static colliders have a
'WALK' mesh in their MDB(s) describing how to merge them into the underlying terrain (or interior tile) walkmesh. This is used by the toolset to produce the final .trx walkmesh data.
- Dynamic collisions don't use the 'WALK' mesh in a placeable's MDB(s), instead they use the
C3/C2 meshes.
- Environment objects aren't considered for line of sight or collision processing of any sort. They are purely decorative.
- Doors also participate in collisions similarly to how I have described above. If a non-static door is closed, it's a dynamic collider; if it is open or destroyed, then it doesn't collide with anything.
- Placeables created on the fly by the DM client are never static placeables. In fact, you can't modify the properties of a static placeable (or an environmental object), or even create a new one, except during design time in the toolset.
- Walk across sound effects come from the walkmesh itself, so making a placeable a dynamic collider will prevent it from altering the walk across sound effects (from whatever the default terrain that the placeable was placed on).
- The
Client Extension has several useful tools to help you better understand how the engine will interact with your walkmesh. It contains a feature that lets you view the walkmesh of a map directly in its Area Map window (click on the Area Map window and hit T to cycle through terrain detail levels until you see the walkmesh, which is drawn as a series of purple triangles). Diagonally shaded purple triangles represent regions that are not walkable.
- The Client Extension also lets you examine what paths objects will take from point to point. Hold down CTRL and move the mouse on the CE's Area Map window to see how an object would move from your location to the target location based on the walkmesh. A red line indicates that there is no reachability.
- Similarly, the Client Extension also lets you check how the game will calculate line of sight from where you're standing to another point; hold down X and move the mouse on the Area Map window. A red line indicates no line of sight.
- For the particularly adventurous, the
NWN2 Datafile Accessor Library (C++) contains code to interact with the raw walkmesh (and other collision meshes) in their on-disk form.
Modifié par SkywingvL, 20 septembre 2010 - 02:43 .