Skip to content

Fix z offset for Actors from SetPos and Move

Frederic Chardon requested to merge fr3dz10/openmw:altitude_fix into master

Fix a bug that was triggered with multi mark mod, reported by eddie5 on Discord. In some spots, the player would be consistently recalled above the ground instead of the marked coordinates.

The sequence used by the script is:

Position x0 y0 0
SetPos x savedx
SetPos y savedy
SetPos z savedz

First call to Position place the actor at ground level at coordinate (x0,y0). Let's call that z0 Next calls to SetPos register a movement offset, with the last one able to move the actor up if it spawn below ground. However, at this time, the actor position is still (x0,y0), not (savedx, savedy) as the script expect. If savedz > z0, no problem. If savedz < z0 and the ground at (savedx, savedy) < z0, the actor is placed at z0, because we check for terrain height at the wrong spot.

To this end move the terrain height check inside of Actor class and check terrain height at the new wanted coordinates.

Merge request reports