bugfix(fxlist): Fix unreliable terrain layer selection of particles using CreateAtGroundHeight - #3004
Conversation
…sing CreateAtGroundHeight
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/GameClient/FXList.cpp | Initializes newPos.z before calling getLayerForDestination to fix uninitialized variable causing wrong terrain layer selection; else-branch refactored to equivalent += expression. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["reallyDoFX called"] --> B["Compute newPos.x, newPos.y via offset + radius * cos/sin"]
B --> C["newPos.z = primary->z + offset.z\n(NEW: initialized here)"]
C --> D{"m_createAtGroundHeight\n&& TheTerrainLogic?"}
D -- Yes --> E["getLayerForDestination(&newPos)\n(now uses valid z for layer detection)"]
E --> F["layer = GROUND or BRIDGE"]
F --> G["newPos.z = getLayerHeight(x, y, layer)"]
D -- No --> H["newPos.z += m_height.getValue()\n(equivalent to old assignment)"]
G --> I["setPosition(&newPos)"]
H --> I
Reviews (2): Last reviewed commit: "Process review comment" | Re-trigger Greptile
|
seems quite simple, does this also affect burn marks being applied to the bridge? |
Scorch marks are different as they are not particles and have their own render path (because they persist the entire match, and you have a max number of scorches) |
Ah i see, that's cool. Does this also affect how particles are placed over uneven terrain? Or is that a different problem? |
|
Good find! Looks good to me |
This change should not affect particle placement at locations where there is only one terrain layer because For particles on uneven terrain I'm working on terrain conforming particles, which instead of the regular method of drawing quads will make tiny meshes by sampling the terrain map, unless that particle is on a bridge in which case its probably best to just draw as a quad |
That's cool, from your pictures showing the terrain conforming particles i thought this might have been part of it. |
When creating a particle system that uses the
CreateAtGroundHeightoption in the INI, the current terrain layer (for example GROUND, or BRIDGE) was not reliably determined because of an uninitialized variable.This mostly affects toxin pools on a bridge which end up on the ground layer instead, see the images.
Before (note the particles on the ground):

After (most of the particles are now on the bridge, some are on the edge and float):
