HughJanus 244 Posted February 21, 2020 Share Posted February 21, 2020 (edited) I want to check if an NPC is on the ground. I am using the following code to get the positions of the headbone and the ground shown on the screen: char c[40]; char c2[40]; float act = 1; float act2 = 1; std::string text = "Zcoord ground = "; std::string text2 = "Zcoord head = "; Vector3 vechead = ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(playerPed, 21030); float groundzcoord; GAMEPLAY::GET_GROUND_Z_FOR_3D_COORD(vechead.x, vechead.y, vechead.z, &groundzcoord, true); act = groundzcoord; text = "Zcoord ground = " + std::to_string(act); act2 = vechead.z; text2 = "Zcoord head = " + std::to_string(act2); strcpy(c, text.c_str()); strcpy(c2, text2.c_str()); DrawText(0.4, 0.4, c); DrawText(0.3, 0.3, c2); Unfortunately both values seem to be always 0: Can someone hint me in the right direction, please? How can I get the z coordinate of the skull (bone ID should be 21030) and from the ground? Edit: here is the line of code that needed correcting: Vector3 vechead = ENTITY::GET_WORLD_POSITION_OF_ENTITY_BONE(playerPed, PED::GET_PED_BONE_INDEX(playerPed, 21030)); Edited February 21, 2020 by HughJanus 1 Quote Link to comment Share on other sites More sharing options...
LMS 674 Posted February 21, 2020 Share Posted February 21, 2020 This native here might also be helpful in your case: 1 Quote Link to comment Share on other sites More sharing options...
HughJanus 244 Posted February 21, 2020 Author Share Posted February 21, 2020 Ah, that would have probably saved me a lot of trouble lol Quote Link to comment Share on other sites More sharing options...
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.