Open StN-NL opened 3 weeks ago
No, that is not expected. The system works on terrain height, there is no difference between cliffs and terrain tool height. Also, not sure what you mean by "ugly". Post a reproducible example.
When I say ugly I am just referencing the terraining crowd (point A): https://www.hiveworkshop.com/threads/advanced-terraining-tutorial.203428/
This is the map: https://github.com/StN-NL/sheepz
The default map is a tropical island (the one in the top left):
Alternatively, using only cliffs, where everything works just fine:
Hope this makes any sense, let me know if you need more info.
It's not really feasible for me to check an entire map's unknown to me script for this specific error, there could be many side effects coming from all kinds of places. I created a minimal example which I think is similar to what you're looking for, a unit that falls down, stays on the ground, but can jump. It seems to work fine for me on a map with smooth hills with negative and positive z values:
package Usage
import EntityManagement
import Projectile
import Heightmap
import PhysicsEntity
import ClosureKeyPresses
class TestUnitEntity extends UnitEntity
use PhysicsModule
construct(vec3 pos)
super(createUnitZ(players[0], 'hfoo', pos, angle(0)), pos)
print(GetObjectName(0))
sleeps = false
onKeyPress(OSKEY_B) ->
addVel(actor.getFacingAngle().toVec(10).withZ(25))
override function update()
super.update()
physicsUpdate(this)
print(pos.toString())
init
new TestUnitEntity(ZERO2.withHeightMap(256))
startEntityLoop()
Only thing from a short look over your code I saw is that you call physicUpdate
before update
, it should be after. But that's not the cause of the problem.
Since this works, I am quite certain the problem is in your code.
So, please create a similar small example to reproduce the issue if you want me to analyze it further.
If you were to run your code using my map Sheepz.w3x you will find your footman is floating near the shores.
Only modification needed to land it on the island:
new TestUnitEntity(vec2(-8000, 8000).withHeightMap(256))
This might be an issue with the map itself then, and I might try to remake it.
Maybe a by-effect of resizing the map.
EDIT: it is definitively an issue with the map file. Sorry for bothering you with this. I created a new map and it seems to work fine.
No problem. Perhaps it's an issue if you change cliff level with water or something, making the height values not be correct. Can this issue be closed then?
Unfortunately recreating the map first caused me to think it worked as I placed the island in a different position.
But when I moved it back to the topleft the same issue reappeared.
To pinpoint the issue I created maps of several sizes with cliff level 4 just to have initial height.
Then I started clicking around to see visualize the heightmap using:
package Test
import ClosureEvents
import FText
import Heightmap
function getMousePos3() returns vec3
let x = EventData.getPlayerMouseX()
let y = EventData.getPlayerMouseY()
let z = vec2(x, y).getHeightMap()
return vec3(x, y, z)
init
FogMaskEnableOff()
FogEnableOff()
EventListener.add(EVENT_PLAYER_MOUSE_DOWN) ->
let pos = getMousePos3()
flashEffect("Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdx", pos)
createFText(pos.toVec2().toVec3(), pos.toString(), 10, 10, ZERO2)
Turns out that the larger the map the smaller the heightmap coverage. The surface that is not covered is for the higher Y values. It seems that the maximum area covered by the heightmap is 268,435,456 or 16,384 tiles (128x128).
To reproduce: 1) create a new map where:
Ok, I see, so it's due to max array size in Jass. Lua wouldn't have this problem, but it has many others 😄 . With the 32768 max size the heightmap can only cover 181x181 tiles, and it starts in bottom right corner, so in the top part of the map the index exceeds 32768. I guess I never made such a big map that the issue would come up. Also, the heightmap is a somewhat recent addition in order to prevent desyncs due to terrain deformations and such. I kept it to a single array for performance’s sake, but I guess if you want to support larger sizes it would require some splitting up or reverting to using regular terrainZ instead, could add an option for that.
Ok, I will reduce the map size for full coverage, sounds like the best approach here. Feel free to close. Before I forget, thanks for Wurst ;)
Well not the best but the fastest workaround I guess. I can add something if I get the time. Enjoy your Wurst.
Hello, using the physics module with cliffs only works fine (a bit ugly though), but when using height instead of cliffs (terrain tool), units start to float (cliff level 0) or objects fall below the surface (higher cliff levels). This is expected?