proper bone esp

Posts 1–3 of 3 · Page 1 of 1
proper bone esp
I've seen a lot of bone ESPs being pasted around with hard coded bones and stuff, that's just stupid.

if you grab a pointer to mstudiobone_t, you can get the parent of your bone like so:
pBone->parent

Using, this all you have to do is loop your bones, check if they have a valid parent (if parent != -1), get the positions of the child and parent bone from your bone matrix and connect the two.
Code:
void Visuals::DrawSkeleton(CBaseEntity* pEntity) {
    
	void* pModel = pEntity->GetRenderable()->GetModel();
	if (!pModel) 
		return;


	studiohdr_t* pStudioMdl = g_pModelInfoClient->GetStudioModel(pModel);
	if (!pStudioMdl) 
		return;


	matrix3x4 matBones[128];
	if (!pEntity->GetBoneMatrix(&matBones[0]))
		return;
        
	for (int i = 0; i < pStudioMdl->numbones; i++) {
		mstudiobone_t* pBone = pStudioMdl->GetBone(i);
		if (pBone && (pBone->flags & 0x100) && pBone->parent != -1) {
			Vector vecParent, vecChild;
			MatrixPosition(matBones[i], vecChildPos);
            		MatrixPosition(matBones[pBone->parent], vecParentPos)
	    		if (Vector::ToScreen(vecChild) && Vector::ToScreen(vecParent))
	    			DrawOverlay::DrawLine(vecChild.x, vecChild.y, vecParent.x, vecParent.y);
        	}
    	}
}
Looks good and short!
Heh. Love the internal memes. Good help for anyone new but i suggest we dont spoonfeed too much.
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us