Jump to content

Recommended Posts

Posted

I'm taking a look at this function:

 

TerrainHeight

Description

Retrieves the relative terrain height at the specified grid point. This is a value between 0 and 1.

 

Syntax

C:

flt TerrainHeight( TEntity terrain, int x, int y )

 

What do I multiply this relative terrain value by to get the appropriate y coordinate for my PositionEntity() function. For the moment I am simply setting my y value high enough that no matter where on the terrain I place my character, she falls to the ground and I can start from there. This isn't an acceptable method for dynamically placing entities in a finished product.

 

Another question. Are the x and y grid coordinate arguments identical to the x and z global position that is returned by EntityPosition(); or is there a conversion?

 

Thanks.

Posted

You need to convert the terrain x,z to entity x,z coordinates. It's something like entity.x=(terrain.x / terrainsize) - (terrainsize / 2) * terrainscale. That's just a quick guess, I have the exact formula somewhere in my game code.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Posted

Don't you just want to use TerrainElevation or am I not understanding. This will give you the terrain height at ANY point on the terrain.

intel i5 2500k, ram 16gb, nvidia Geforce GTX570, asus xonar sound card. Windows 7 64 bit

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.   Paste as plain text instead

  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...