Me and a friend has been working on a map that plays out in first person.
We have a trigger that runs quite often that is made to move the hero around and set the camera height.
In order to set the camera height, we use the function "GetLocationZ(Location)" to find the terrain height at the position of the hero.
We had a bug because of the fact that the optimal camera height and terrain height isn't the same but abit of math fixed it.
Anyways, here is the problem:
When you walk close to the edge of a cliff, the camera gets further and further down towards the ground and eventually ends up below the terrain. We do not have the same problem when just changing terrain height to create cliffs, but my friend/terrainer insists that we use cliffs since he has a hard time making stairs otherwise, and he has already done alot of terrain this way.
I've run a text message to show me the Zheight and the result that the camera should pan It's height to, and its always the same even though the height gets farther and farther down. I think this has something to do with the fact that the camera goes up and down when it faces a cliff in overview mode.
Here is the part of the trigger that matters:
So I need to find a way to prevent the height to change near edges of cliffs, perhaps another function/action that changes the height?
Here are screenshots of what happens.
The real behind the "Z:" is the actual terrain height.
The real below that is what the calculated (camera) height is.
The trigger runs fast, therefore there is alot of text messages
When standing at center of cliff
Here is what happens at edge of cliff, as you can see the reals are the same.
I accidently overlapped the pictures (sry) but it still shwos what I want.
Anyone has any ideas?
Summary to clear misunderstandings
I use getLocationZ to calculate terrain height. I want to use this to set camera height.
But when im near edge of cliffs the camera ends up below the terrain even though the terrainheight is the same as when im above it, at center of the cliff.
I think this has something to do with wc3's standard way of panning camera when it ends up at cliff terrain. Anyone has a smart sulotion?
We have a trigger that runs quite often that is made to move the hero around and set the camera height.
In order to set the camera height, we use the function "GetLocationZ(Location)" to find the terrain height at the position of the hero.
We had a bug because of the fact that the optimal camera height and terrain height isn't the same but abit of math fixed it.
Anyways, here is the problem:
When you walk close to the edge of a cliff, the camera gets further and further down towards the ground and eventually ends up below the terrain. We do not have the same problem when just changing terrain height to create cliffs, but my friend/terrainer insists that we use cliffs since he has a hard time making stairs otherwise, and he has already done alot of terrain this way.
I've run a text message to show me the Zheight and the result that the camera should pan It's height to, and its always the same even though the height gets farther and farther down. I think this has something to do with the fact that the camera goes up and down when it faces a cliff in overview mode.
Here is the part of the trigger that matters:
-
hello world
-
Events
- Time - Every 0.08 seconds of game time
- Conditions
-
Actions
- Set Loc = (Position of PlayerCamUnit[(Integer A)])
- Custom script: set udg_ZHeight = GetLocationZ(udg_Loc)
- Set TempReal[2674] = (1.00 - (ZHeight / (ZHeight + 26.00)))
- Camera - Set (Player((Integer A)))'s camera Height Offset to ((ZHeight x TempReal[2674]) + 200.00) over 0.00 seconds
- Custom script: call RemoveLocation (udg_Loc)
-
Events
So I need to find a way to prevent the height to change near edges of cliffs, perhaps another function/action that changes the height?
Here are screenshots of what happens.
The real behind the "Z:" is the actual terrain height.
The real below that is what the calculated (camera) height is.
The trigger runs fast, therefore there is alot of text messages
When standing at center of cliff
Here is what happens at edge of cliff, as you can see the reals are the same.
I accidently overlapped the pictures (sry) but it still shwos what I want.
Anyone has any ideas?
Summary to clear misunderstandings
I use getLocationZ to calculate terrain height. I want to use this to set camera height.
But when im near edge of cliffs the camera ends up below the terrain even though the terrainheight is the same as when im above it, at center of the cliff.
I think this has something to do with wc3's standard way of panning camera when it ends up at cliff terrain. Anyone has a smart sulotion?
Last edited: