Skip to content

Properly calculate touch spell hit position (#6156)

Alexei Kotov requested to merge Capostrophic/openmw:whoanotouchy into master

Fixes #6156 (closed).
The hit position matters for the placement of non-zero area effect VFX and AOE origin. In some cases, the hit position wouldn't be calculated at all -- the player's position would be used instead -- because of the early-out for faced objects that can be activated. In other cases, the hit position would be based on where the target was "touched", which is actually not something Morrowind does. This uses the empirically determined position for actors for both actors and non-actors (see explanation and justification in the added comment). Morrowind's non-actor explosions seem buggy. This now relies on Hrnchamd's research: for actor targets, the explosion is spawned at 0.7 of their height. For non-actor targets, Morrowind does something very silly (see the added comment), so I opted for a solution Hrnchamd suggested that compromises between the logical approach I originally tried to elect and what Bethesda might have had in mind. Note the collision box offset is intentionally ignored.

This MR:
screenshot673

Morrowind:
изображение

master: spawns the effect at the player's feet, generally.

This also reorganizes the logic and drops some dead code. The idea behind the hit contact "is actor" check is no longer applicable now that melee hit contact can only return an actor. The original idea behind the distance check was to discard the target if they were picked up by two of the contact attempts but can't be activated thanks to telekinesis but fCombatDistance used for melee hit contact is generally much lower than the activation distance while the raycast has been using the base activation distance as its length for a while, so they haven't been doing much. A ray is only cast if melee hit contact didn't pick up an actor. Combat targets used for melee hit contact are recovered in getHitContact.

Something to keep in mind is that Morrowind seems not to scale Touch explosions the same way as Target explosions. I couldn't determine the exact principle behind it, and that's not what the issue is for either way.

Edited by Alexei Kotov

Merge request reports

Loading