Clackdor Posted October 19, 2011 Posted October 19, 2011 I'm taking a look at this function: TerrainHeightDescription 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. Quote
Canardia Posted October 19, 2011 Posted October 19, 2011 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. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■
Kronos Posted October 21, 2011 Posted October 21, 2011 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. Quote intel i5 2500k, ram 16gb, nvidia Geforce GTX570, asus xonar sound card. Windows 7 64 bit
Recommended Posts
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.