• Getting the HitBox of a bone?
    0 replies, posted
Hello. I was looking getting the ent:GetHitBoxBone(). However, it returns the bone based on the hitbox, instead of the hitbox based on the bone. I've already written up a code to get the hitbox based on my bone. But is there a function already out there for this or an easier way of doing it? (I.E running less loops and lines of code, even though I assume the loops will still run if such a function exists) My code: [code] local JSHBGroups = ply:GetHitBoxGroupCount() -- The amount of groups of hitboxes in the ent local JSHBXS = {} -- My little table to store the hitboxs I need JSHBXS.LeftHandHB = {} JSHBXS.RightHandHB = {} for k=0, JSHBGroups - 1 do -- Loops through all the hitbox groups with i = the hitbox group num local HBCount = ply:GetHitBoxCount(k) -- The amount of hitboxes in the hitbox group for v=0, HBCount do -- Loop through all the hitboxes in the group 'i' -- k now = the hitbox group and v = the hitbox in that group local mybone = ply:GetHitBoxBone(v,k) -- Gets a bone based on k,v if mybone == RBS.LHand then -- RBS.LHand is the bone id for Left hand JSHBXS.LeftHandHB["Group"] = k JSHBXS.LeftHandHB["HB"] = v elseif mybone == RBS.RHand then -- Same thing with right hand JSHBXS.RightHandHB["Group"] = k JSHBXS.RightHandHB["HB"] = v end end end for k,v in pairs(JSHBXS) do local boneid = ply:GetHitBoxBone(v["HB"], v["Group"]) -- HB first, then group print(ply:GetBoneName(boneid)) -- Prints the bone from the bone ID we got from the hitbox we checked end [/code]
Sorry, you need to Log In to post a reply to this thread.