Jump to content
Developer Wiki and Function Reference Links ×

Script to randomise Z-height within a certain amount


HP Sauce

Recommended Posts

How would one go about scripting such a thing?

Usage in example:

Ten image prop symbols of a bush are placed at Z0. The user selects the symbols, executes the script, and is asked for a minimum and maximum Z height along with a direction constraint (lower only for example). The script then randomly moves the symbols up or down on the Z plane.

Link to comment

Use Move3DObj(0, 0, dZ); to move an individual object.

To generate a random value between to numbers, use the following function:

function RandVal(LL, UL :Real) :Real;
{ Generate a random value in the range LL -> UL inclusive. }
Begin
UL := UL - LL;
RandVal := Random * UL + LL;
End;		{ RandVal }

By sending the appropriate limits to the RandVal function you can control whether your objects move up or down.

Raymond

Link to comment
How would one go about scripting such a thing?

Usage in example:

Ten image prop symbols of a bush are placed at Z0. The user selects the symbols, executes the script, and is asked for a minimum and maximum Z height along with a direction constraint (lower only for example). The script then randomly moves the symbols up or down on the Z plane.

Shouldn't the symbols be Sent to Surface? In the absence of a DTM? Ah-ha! Lower only?

Whatever. I must investigate this in relation to my Forest Simulator.

forestandtrees.png

Link to comment

Forest Simulator... Gold! That looks like a great tool.

Sent to Surface? No sir, this was purely for artsy renderings wherein a row of duplicated bush symbols are not all exactly the same height, producing a much more natural look.

Thanks for the code snippet and direction MullinRJ.

Link to comment

Sent to Surface? No sir, this was purely for artsy renderings wherein a row of duplicated bush symbols are not all exactly the same height, producing a much more natural look.

Yes, a great idea, which I may incorporate into my tool, although the main workflow is that after the forest has been created, trees & shrubs are sent to surface. (I use it to create random tree covers as backdrops.)

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...