Jump to content
RAGE Multiplayer Community

Snippet: get BoneId from BoneIndex


Recommended Posts

On my project I faced the problem where I only had the boneIndex but I needed the BoneId.
I've wrote a small module for that:

 

Defining Object with all BoneIds:

Spoiler
const BoneName_BoneId = {
  SKEL_ROOT: 0,
  FB_R_Brow_Out_000: 1356,
  SKEL_L_Toe0: 2108,
  MH_R_Elbow: 2992,
  SKEL_L_Finger01: 4089,
  SKEL_L_Finger02: 4090,
  SKEL_L_Finger31: 4137,
  SKEL_L_Finger32: 4138,
  SKEL_L_Finger41: 4153,
  SKEL_L_Finger42: 4154,
  SKEL_L_Finger11: 4169,
  SKEL_L_Finger12: 4170,
  SKEL_L_Finger21: 4185,
  SKEL_L_Finger22: 4186,
  RB_L_ArmRoll: 5232,
  IK_R_Hand: 6286,
  RB_R_ThighRoll: 6442,
  SKEL_R_Clavicle: 10706,
  FB_R_Lip_Corner_000: 11174,
  SKEL_Pelvis: 11816,
  IK_Head: 12844,
  SKEL_L_Foot: 14201,
  MH_R_Knee: 16335,
  FB_LowerLipRoot_000: 17188,
  FB_R_Lip_Top_000: 17719,
  SKEL_L_Hand: 18905,
  FB_R_CheekBone_000: 19336,
  FB_UpperLipRoot_000: 20178,
  FB_L_Lip_Top_000: 20279,
  FB_LowerLip_000: 20623,
  SKEL_R_Toe0: 20781,
  FB_L_CheekBone_000: 21550,
  MH_L_Elbow: 22711,
  SKEL_Spine0: 23553,
  RB_L_ThighRoll: 23639,
  PH_R_Foot: 24806,
  SKEL_Spine1: 24816,
  SKEL_Spine2: 24817,
  SKEL_Spine3: 24818,
  FB_L_Eye_000: 25260,
  SKEL_L_Finger00: 26610,
  SKEL_L_Finger10: 26611,
  SKEL_L_Finger20: 26612,
  SKEL_L_Finger30: 26613,
  SKEL_L_Finger40: 26614,
  FB_R_Eye_000: 27474,
  SKEL_R_Forearm: 28252,
  PH_R_Hand: 28422,
  FB_L_Lip_Corner_000: 29868,
  SKEL_Head: 31086,
  IK_R_Foot: 35502,
  RB_Neck_1: 35731,
  IK_L_Hand: 36029,
  SKEL_R_Calf: 36864,
  RB_R_ArmRoll: 37119,
  FB_Brow_Centre_000: 37193,
  SKEL_Neck_1: 39317,
  SKEL_R_UpperArm: 40269,
  FB_R_Lid_Upper_000: 43536,
  RB_R_ForeArmRoll: 43810,
  SKEL_L_UpperArm: 45509,
  FB_L_Lid_Upper_000: 45750,
  MH_L_Knee: 46078,
  FB_Jaw_000: 46240,
  FB_L_Lip_Bot_000: 47419,
  FB_Tongue_000: 47495,
  FB_R_Lip_Bot_000: 49979,
  SKEL_R_Thigh: 51826,
  SKEL_R_Foot: 52301,
  IK_Root: 56604,
  SKEL_R_Hand: 57005,
  SKEL_Spine_Root: 57597,
  PH_L_Foot: 57717,
  SKEL_L_Thigh: 58271,
  FB_L_Brow_Out_000: 58331,
  SKEL_R_Finger00: 58866,
  SKEL_R_Finger10: 58867,
  SKEL_R_Finger20: 58868,
  SKEL_R_Finger30: 58869,
  SKEL_R_Finger40: 58870,
  PH_L_Hand: 60309,
  RB_L_ForeArmRoll: 61007,
  SKEL_L_Forearm: 61163,
  FB_UpperLip_000: 61839,
  SKEL_L_Calf: 63931,
  SKEL_R_Finger01: 64016,
  SKEL_R_Finger02: 64017,
  SKEL_R_Finger31: 64064,
  SKEL_R_Finger32: 64065,
  SKEL_R_Finger41: 64080,
  SKEL_R_Finger42: 64081,
  SKEL_R_Finger11: 64096,
  SKEL_R_Finger12: 64097,
  SKEL_R_Finger21: 64112,
  SKEL_R_Finger22: 64113,
  SKEL_L_Clavicle: 64729,
  FACIAL_facialRoot: 65068,
  IK_L_Foot: 65245,
};

 

const BoneIndex_BoneId = {};

Object.values(BoneName_BoneId).forEach((boneId) => {
  BoneIndex_BoneId[mp.players.local.getBoneIndex(boneId)] = boneId;
});

const getBoneIdFromIndex = index => BoneIndex_BoneId[index];

export {
  BoneName_BoneId,
  BoneIndex_BoneId,
  getBoneIdFromIndex
}

 

Edited by araynimax
code blocks
Link to post
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...