I'm making an arcade like game. In it, I want a bridge that land units traverse, but the player's boat can sail beneath. I have a way to do it, but I'm hung up on some issues involving the height of terrain in water.
My general plan: make the bridge non-functional (just a doodad). The boat can therefore sail normally under it. Meanwhile, land units that approach the bridge from the right have collision removed, storm crow added and removed, and then have their height adjusted so that they "fly" at the height of the bridge. This will make it look like they're walking across it.
So what flying height do I use for the unit? I've been getting the Z-height of the terrain at the point of the unit (every .03) and adjusting its flying height accordingly. I discovered the height of the bridge, and then set the height of the walking unit to that height minus the terrain height he is currently at.
Problem: It works fine when the unit is in the middle of the bridge, but when the unit is over land it starts flying. I think the problem is that the "GetLocationZ" function works weirdly on water; or that the unit is responding to nearby cliffs (like how fliers start ramping up when near a cliff).
I've attached the testing map here. If you play test it, just find the peasant to the right of where the camera starts, and walk him onto the bridge.
My general plan: make the bridge non-functional (just a doodad). The boat can therefore sail normally under it. Meanwhile, land units that approach the bridge from the right have collision removed, storm crow added and removed, and then have their height adjusted so that they "fly" at the height of the bridge. This will make it look like they're walking across it.
So what flying height do I use for the unit? I've been getting the Z-height of the terrain at the point of the unit (every .03) and adjusting its flying height accordingly. I discovered the height of the bridge, and then set the height of the walking unit to that height minus the terrain height he is currently at.
Problem: It works fine when the unit is in the middle of the bridge, but when the unit is over land it starts flying. I think the problem is that the "GetLocationZ" function works weirdly on water; or that the unit is responding to nearby cliffs (like how fliers start ramping up when near a cliff).
I've attached the testing map here. If you play test it, just find the peasant to the right of where the camera starts, and walk him onto the bridge.