Using HeightMap to make general scalar field

Hello everyone, just trolling for some advice.



I’m making a simple scalar field on my map which makes objects move faster or slower (or not at all) depending on their xz location. It’s used for objects floating on a river surface. I am using the terrain heightmap-values for this. The very simple system works like this:



A custom controller attached to the floating object gets the height of the terrain at the objects location every update, then changes the location by vector-adding its local translation with a normalized vector times a constant multiple of the height.



This seems like a good approach, because the running-speed of water in a river actually depends a great deal on the depth (deeper means slower speed), and it also makes editing easy (wanna change the field, just change the riverbed).



My question is, what if i want to alter this system by adding a different heightmap, with a modified image? Is the heightmap “system” ok for generating scalar fields like this in the engine or would you go about it differently?



For example I might want to use the same image as before, but with all points outside the water blacked out (thus adding 0 to the controlled objects movement). Or I might want to use some other image to create a “pseudo rotational field” or whatever. Then I’d have to generate a new map, sync it to the terrain etc. Is there a better way perhaps, I have no idea.

Sounds like a valid idea.

thank you for answering, great. haven’t had any problems just wanted to get it right from the start…