Log in to reply
 

What is the rotation order of GetEntityBoneRotationLocal?



  • Hi,

    I am accessing the local rotation of a bone however I need it to be in the order of ZXY.

    Can someone tell me what the rotation order is from the native? _GET_ENTITY_BONE_ROTATION_LOCAL

    What does the native function exactly return ?

    Thank you!



  • @mshooter test it and see what it returns, but AFAIK, you should get the vector3 and the order is always, x, y, z

    https://docs.fivem.net/docs/scripting-reference/runtimes/lua/functions/vector3/

    (lua but still same native - although it may have been replaced)

    probably used with this

    PED::GET_PED_BONE_COORDS
    Vector3 GET_PED_BONE_COORDS(Ped ped, int boneId, float offsetX, float offsetY, float offsetZ) // 0x17C07FC640E86B4E 0x4579CAB1 b323

    Gets the position of the specified bone of the specified ped.

    ped: The ped to get the position of a bone from.
    boneId: The ID of the bone to get the position from. This is NOT the index.
    offsetX: The X-component of the offset to add to the position relative to the bone's rotation.
    offsetY: The Y-component of the offset to add to the position relative to the bone's rotation.
    offsetZ: The Z-component of the offset to add to the position relative to the bone's rotation.



  • @JohnFromGWN

    Thank you for answering, I am seeing the values which are angles in degrees
    however, how can I test it?

    am I using it wrongly, I am trying to get the rotation of a child bone with respect to the parent. (hence local rotation)

    additionally, I would like to convert the rotation order to ZXY would you know how to do it?



  • @mshooter sorry have not used that function and it will not appear in vs 2019 intellisense.

    If you're getting degrees, its just an integer?

    Just curious, why change to something other than x, y, z?

    You definitely could do something like position.z, position.y, position.x, or any combo, but why?



  • @JohnFromGWN the function is working for me, it returns float numbers supposly in degrees.

    I want to change the order because I am currently exporting a motion sequence (.bvh file format) are you familiar with those?
    https://www.cs.cityu.edu.hk/~howard/Teaching/CS4185-5185-2007-SemA/Group12/BVH.html

    Otherwise I am sure I can compute the local rotations based on the bone world rotations, however I am not too sure how to do that either, as the function _GET_ENTITY_BONE_ROTATION is also giving me a vector.



  • @mshooter you must be using SHVDN 2?



  • @JohnFromGWN
    I am using scripthookVdotnet (v3)



  • So, i did a test, where I animate the peds arm and rotate it from 0 to 90 degrees around the x-axis.
    When I use the native _GET_ENTITY_BONE_ROTATION which normally would give the global rotation it doesn't give the numbers I expect which would be 0-90 degrees for the x-axis and the y and z-axis it would give me 0 as the ped's arm doesn't move around the y or z axis.

    The numbers I am getting for the x-axis are float numbers between -34 and -35.
    Then I am getting 98.something for the y-axis and for the z-axis I am getting floating numbers between 129 and 130.

    Am I getting something wrong? does anyone know what values this native is returning ? are those values supposed to be in degrees?



  • @mshooter don't know. Do know a float needs f afterwards or at least one decimal, or it won't do what is expected.

    I learned this when i removed the decimals from a float and my script no longer worked, no compiler error, no run time errors, just stopped working. Adding back a decimal, or the f, fixed it immediately.

    Native db will tell you if int or float.



  • I know about the float numbers,
    but that shouldn't matter really, as I am getting a vector3 from that function where the x,y and z values are float numbers.

    what I am trying to figure out is, what is this function returning, values in degrees?

    Edit [more information]:
    I did more tests where I rotate the bone solely around the Y-axis and Z-axis.
    No matter which axis it rotates, solely the third value of the Vector3 changes through time and the first two don't.


Log in to reply
 

Looks like your connection to GTA5-Mods.com Forums was lost, please wait while we try to reconnect.