- Joined
- Nov 3, 2006
- Messages
- 8,102
This function lets you set camera Z exactly where you need it, the vanilla functionality of this kind is bugged because wc3 uses some sort of a height averaging algorithm so whatever height you input will change as average height around camera target changes, and this solves that issue by abusing some kind of camera mechanic.
I am posting this here not because I made it or because it's complex, but because I searched for this for a while and couldn't find it anywhere, I had to dig it out of a really old map of mine, because I forgot the exact mechanics of how it works, I was told of this snippet by ToadCop a long time ago, though I am not sure he's the one who discovered it.
I am posting this here not because I made it or because it's complex, but because I searched for this for a while and couldn't find it anywhere, I had to dig it out of a really old map of mine, because I forgot the exact mechanics of how it works, I was told of this snippet by ToadCop a long time ago, though I am not sure he's the one who discovered it.
JASS:
function SetCameraZ takes real z returns nothing
set z = GetCameraField(CAMERA_FIELD_ZOFFSET) + z-GetCameraTargetPositionZ()
call SetCameraField(CAMERA_FIELD_ZOFFSET, z, -0.01)
call SetCameraField(CAMERA_FIELD_ZOFFSET, z, 0.01)
endfunction