Jump to content

» «

02CE: [email protected] = ground_z_at [email protected] [email protected] 0.0 [PROBLEM]

3 replies to this topic
  • gokuta

    Square Civilian

  • Members
  • Joined: 24 Apr 2014
  • Afghanistan


Posted 26 April 2014 - 03:21 PM Edited by gokuta, 26 April 2014 - 03:25 PM.

So, this opcode has three parameters:


(1) X coord
(2) Y coord

(3) Z coord ? This is what I'm trying to find out, parameter seems to be useless (is it?)


Returned value is supposed to be a height of the ground when X and Y (and Z) are specified. But well, it normally returns me height which is below the ground and also it returns a height above the ground if I'm under water (seems like it simply returns me zero). Am I using it improperly or what? It does not return me the Z coordinate of the ground.

  • fastman92

    фастман92 | ف

  • Members
  • Joined: 28 Jul 2009
  • Poland
  • Best Total Overhaul 2017 Contribution [GTA: Underground]
    Best Conversion 2016 [GTA: Underground] [Contribution]
    Contribution Award [Mods]


Posted 26 April 2014 - 03:57 PM Edited by fastman92, 26 April 2014 - 04:02 PM.

The Z parameter is not useless. Consider that a map may consist of many layers:

This command will return coordinates to closest lower layer from map.

GTAG 2.0
02CE=4,get_ground_z_for_3d_coord %1d% %2d% %3d% store_to %4d%

  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None
  • Contribution Award [Mods]


Posted 26 April 2014 - 04:23 PM Edited by Deji, 26 April 2014 - 04:28 PM.

Well, you need to check for water with 092E. If water height is higher than the ground height, the position is probably above water.

I'd think the Z coord would make the command, only return heights below it. Though -100.0 as a Z coord is known to do this job for the highest ground in this and many other commands (such as create_char).

However, one infamous problem occurring from this happens when the area of the position of the map you're trying to get the height of isn't loaded. It would work perfectly in an area in CJ's range, though. So to get the coordinates you first need to load the scene.

Keeping the scene loaded can be a bit of an issue though. If the area is not near the player, it'll just be streamed out. You specifically want the collision to stay loaded. If you know the part of the map you're getting the height of, this is completely avoidable by using LOAD_MODEL with the model IDs used to make up at that point. I have no ultimate solution (or I may have, but have forgotten the specifics) for the other, though my interest was to keep the map loaded during camera movement. On the other hand, LOAD_SCENE may work fine for you if you only nees it to get the ground height. If you want to teleport there, you have to try to make it happen without falling below the ground.

EDIT: Posting on mobile, I may be able to find a definite solution when I get back on PC.

  • gokuta

    Square Civilian

  • Members
  • Joined: 24 Apr 2014
  • Afghanistan


Posted 26 April 2014 - 08:59 PM Edited by gokuta, 26 April 2014 - 10:40 PM.

Thanks, Deji, some testing showed, that you were right about the Z coordinate meaning minimum height. A also tried to set area rendering for areas containing no collision data (that are far away from the player), but it didn't work out. The area was rendered for a really short time only and my code got no clue about what the correct height is :x how to properly render a distant area?

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users