Jump to content

[SA] CLEO. How to find ground/surface height when char is on object.


vladvo

Recommended Posts

Example:

CJ is standing on a roof of a house. (Z = 50.0)

Ground near house has Z = 30.0

 

If I use  02CE: GET_GROUND_Z_FOR_3D_COORD - it would return the roof's Z, not the actual ground Z.

CWorld::FindGroundZForCoord(float x,float y) 0x569660

CWorld::FindLowestZForCoord(float x,float y) 0x5697F0 

I used this opcode 0AA7: call_function_return 0x569660 num_params 2 pop 2 1@ 2@ 5@

Both of them return 1.0 no matter where I am.

 

So far, the only way I see to get Z:

Find collided entity

from CPed->CPhysical  get  0xBC m_apCollidedEntities dd 6 dup

and then get this entity's/object's coordinates.

Is there a better way ?

Link to comment
Share on other sites

04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0
02CE: 4@ = ground_z_at 4@ 5@ 6@
050A: 7@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@

or this 


0819: 1@ = actor $PLAYER_ACTOR distance_from_ground

Link to comment
Share on other sites

@Strs what if i fly over the bridge of san fierro,

what returns 02CE: or 0819: ?

the bridge or the seabed?

i think the bridge

how to get seabed ground in this case?

Link to comment
Share on other sites

i try all stuff and look in memory no luck because sa use road roof and wall same as object cant measure ground when on roof

 

{$CLEO .cs}
0000:
while true
wait  0
for   0@ = 0 to 1000 // just calculation 1000 can go high if you want ground to up  
0093: 7@ = integer 0@ to_float
0013: 7@ * -1.0
04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0
04C4: create_coordinate 4@ 5@ 6@ from_actor $PLAYER_ACTOR offset 0.0 0.0 7@
if    06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 0 actor 0 object 0 particle 0
then  050A: 8@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@
end 
if    06BD: no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 0 car 0 actor 0 object 1 particle 0 
then  050A: 9@ = distance_between_XYZ 1@ 2@ 3@ and_XYZ 4@ 5@ 6@
else  0087: 10@ = 9@ //i use it here because if you moving and object is small in size you wont see any number changed it will store and show in text idk what to say XD
end 
0ad1: "~p~Distance ~n~~y~Solid ~w~%.1f ~n~~r~ Object ~w~%.1f" 2000 8@ 10@
end
end  

 

//note:
0AA7: call_function 0x569660 num_params 2 pop 2 _Y 5@ _X 4@ _return 11@  //call function works in revers like 3 2 1 not 1 2 3 
//and yea this function works like 
//0604: get_Z_angle_for_point 1@ 2@ store_to 3@ 
//how can you get result if you measuring x and y and you get z ? this is angle i guess..

 

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.