Hitboxes from bones

Posts 112 of 12 · Page 1 of 1
Hitboxes from bones
In T_T's source I have seen this:
Code:
Vector3D BottomHitboxHead = Entity[Target].GetBoneFast(10); // Gets the position of the headbone
BottomHitboxHead.x += -2.771300f;// offsets for the bottom corner of the cube
BottomHitboxHead.y += -2.878300f;
BottomHitboxHead.z += -3.103000f;

Vector3D TopHitboxHead = Entity[Target].GetBoneFast(10); // Gets the position of the headbone
TopHitboxHead.x += 6.955000f; // offsets for the Top corner of the cube
TopHitboxHead.y += 4.020300f;
TopHitboxHead.z += 5.006700f;
I am woundernig how to get these offset values for other hitboxes eg Chest?
Thanks in advance
The Vector3 contains the x,y and z coordinates of the Bone. They arent real Hitboxes.
Also you dont need new offsts, they are all stored in the Bones arry in his Programm
owww no no i know that the bone is just a point in 3D space and the offsets are the new coordinates of the 2 corners of the hitbox cube, this offsets are for the head 'cube' (hitbox), but won't it be cool to have all the hitboxes (cubes) around all the bones.
I think figuring out the bot/top postions is jut trial and error
i think the -2.771300f is a bit too precise for trial and error, there must me some way to get the hitbox cube and then having the coordinates of the corners and the bone itself we can get the offsets. That's more realistic then trial and error, but I am new and have no idea what I am talking about so...
Is there a way to get the hitboxes?
These are not mine, all credit goes to reactiioN'.
Hitboxes and bone defines
Code:
enum HitboxList{
HITBOX_PELVIS, HITBOX_L_THIGH, HITBOX_L_CALF, HITBOX_L_FOOT, HITBOX_R_THIGH, HITBOX_R_CALF, HITBOX_R_FOOT, HITBOX_SPINE1, HITBOX_SPINE2, HITBOX_SPINE3, HITBOX_NECK, HITBOX_HEAD, HITBOX_L_UPPERARM, HITBOX_L_FOREARM, HITBOX_L_HAND, HITBOX_R_UPPERARM, HITBOX_R_FOREARM, HITBOX_R_HAND, HITBOX_L_CLAVICLE, HITBOX_R_CLAVICLE, HITBOX_HELMET, HITBOX_SPINE4, HITBOX_MAX
}; enum BoneList{
BONE_PELVIS, BONE_SPINE1, BONE_SPINE2, BONE_SPINE3, BONE_SPINE4, BONE_NECK, BONE_L_CLAVICLE, BONE_L_UPPER_ARM, BONE_L_FOREARM, BONE_L_HAND, BONE_HEAD, BONE_FORWARD, BONE_R_CLAVICLE, BONE_R_UPPER_ARM, BONE_R_FOREARM, BONE_R_HAND, BONE_WEAPON, BONE_WEAPON_SLIDE, BONE_WEAPON_R_HAND, BONE_WEAPON_L_HAND, BONE_WEAPON_CLIP1, BONE_WEAPON_CLIP2, BONE_SILENCER, BONE_R_THIGH, BONE_R_CALF, BONE_R_FOOT, BONE_L_THIGH, BONE_L_CALF, BONE_L_FOOT, BONE_L_WEAPON_HAND, BONE_R_WEAPON_HAND, BONE_L_FORETWIST, BONE_L_CALFTWIST, BONE_R_CALFTWIST, BONE_L_THIGHTWIST, BONE_R_THIGHTWIST, BONE_L_UPARMTWIST, BONE_R_UPARMTWIST, BONE_R_FORETWIST, BONE_R_TOE, BONE_L_TOE, BONE_R_FINGER01, BONE_R_FINGER02, BONE_R_FINGER03, BONE_R_FINGER04, BONE_R_FINGER05, BONE_R_FINGER06, BONE_R_FINGER07, BONE_R_FINGER08, BONE_R_FINGER09, BONE_R_FINGER10, BONE_R_FINGER11, BONE_R_FINGER12, BONE_R_FINGER13, BONE_R_FINGER14, BONE_L_FINGER01, BONE_L_FINGER02, BONE_L_FINGER03, BONE_L_FINGER04, BONE_L_FINGER05, BONE_L_FINGER06, BONE_L_FINGER07, BONE_L_FINGER08, BONE_L_FINGER09, BONE_L_FINGER10, BONE_L_FINGER11, BONE_L_FINGER12, BONE_L_FINGER13, BONE_L_FINGER14, BONE_L_FINGER15, BONE_R_FINGER15, BONE_MAX
};

Hitbox Structure
Code:
struct Hitbox_t{
    int iBone;
    Vector vMin;
    Vector vMax;
    void Setup( int bone, Vector min, Vector max ){
        iBone = bone;
        vMin = min;
        vMax = max;
    }
};
extern Hitbox_t    Hitbox[ 21 ];
Hitboxes
Code:
Hitbox[ 0 ].Setup( BONE_PELVIS, Vector( -6.42f, -5.7459f, -6.8587f ), Vector( 4.5796f, 4.5796f, 6.8373f ) );
Hitbox[ 1 ].Setup( BONE_L_THIGH, Vector( 1.819f, -3.959f, -2.14f ), Vector( 22.149002f, 3.424f, 4.5796f ) );
Hitbox[ 2 ].Setup( BONE_L_CALF, Vector( 2.0758f, -3.21f, -2.1507f ), Vector( 19.26f, 2.675f, 3.0495f ) );
Hitbox[ 3 ].Setup( BONE_L_FOOT, Vector( 1.8725f, -2.675f, -2.4075f ), Vector( 5.6175f, 9.694201f, 2.4075f ) );
Hitbox[ 4 ].Setup( BONE_R_THIGH, Vector( 1.819f, -3.7557f, -4.5796f ), Vector( 22.149002f, 3.424f, 2.14f ) );
Hitbox[ 5 ].Setup( BONE_R_CALF, Vector( 2.0758f, -3.21f, -2.8462f ), Vector( 19.26f, 2.675f, 2.247f ) );
Hitbox[ 6 ].Setup( BONE_R_FOOT, Vector( 1.8725f, -2.675f, -2.4075f ), Vector( 5.6175f, 9.694201, 2.4075f ) );
Hitbox[ 7 ].Setup( BONE_SPINE2, Vector( -4.28f, -4.5796f, -6.3879f ), Vector( 3.21f, 5.885f, 6.2809f ) );
Hitbox[ 8 ].Setup( BONE_SPINE3, Vector( -4.28f, -5.029f, -6.0883f ), Vector( 3.21f, 5.885f, 5.9813f ) );
Hitbox[ 9 ].Setup( BONE_SPINE4, Vector( -4.28f, -5.35f, -5.885f ), Vector( 2.9211f, 5.1467f, 5.885f ) );
Hitbox[ 10 ].Setup( BONE_NECK, Vector( 0.3317f, -3.0174f, -2.4503f ), Vector( 3.4026f, 2.4182f, 2.354f ) );
Hitbox[ 11 ].Setup( BONE_HEAD, Vector( -2.7713f, -2.8783f, -3.103f ), Vector( 6.955f, 3.5203f, 3.0067f ) );
Hitbox[ 12 ].Setup( BONE_L_UPPER_ARM, Vector( -2.675f, -3.21f, -2.14f ), Vector( 12.84f, 3.21f, 2.14f ) );
Hitbox[ 13 ].Setup( BONE_L_FOREARM, Vector( -0.f, -2.14f, -2.14f ), Vector( 9.63f, 2.14f, 2.14f ) );
Hitbox[ 14 ].Setup( BONE_L_HAND, Vector( -1.7227f, -1.2198f, -1.3803f ), Vector( 4.4726f, 1.2198f, 1.3803f ) );
Hitbox[ 15 ].Setup( BONE_R_UPPER_ARM, Vector( -2.675f, -3.21f, -2.14f ), Vector( 12.84f, 3.21f, 2.14f ) );
Hitbox[ 16 ].Setup( BONE_R_FOREARM, Vector( -0.f, -2.14f, -2.14f ), Vector( 9.63f, 2.14f, 2.14f ) );
Hitbox[ 17 ].Setup( BONE_R_HAND, Vector( -1.7227f, -1.2198f, -1.3803f ), Vector( 4.4726f, 1.2198f, 1.3803f ) );
Hitbox[ 18 ].Setup( BONE_L_CLAVICLE, Vector( -0.f, -3.21f, -5.35f ), Vector( 7.49f, 4.28f, 3.21f ) );
Hitbox[ 19 ].Setup( BONE_R_CLAVICLE, Vector( -0.f, -3.21f, -3.21f ), Vector( 7.49f, 4.28f, 5.35f ) );
Hitbox[ 20 ].Setup( BONE_HEAD, Vector( -2.5038f, 2.009f, -1.1021f ), Vector( 6.3023f, 5.2965f, 0.9951f ) );
Hitbox[ 21 ].Setup( BONE_SPINE4, Vector( -0.2996f, -6.0027f, -4.996901f ), Vector( 5.4998f, 2.5038f, 5.1039f ) );
wow man, I wanted to spam that thanks button but it dissipated, man i can't describe in words how thankful im, thank you
You can call me a noob, but I have no idea what Im doing wrong:
I have created a new header file put the Hitboxes and bones defines in there along with the hitbox structure, then created an init function with the hitbox setups and outside the function said "Hitbox_t Hitbox[21];" for the extern. Then called the init function in my main and it did setup all the hitboxes but all my "read offset functions" now throw an access violation exceptions, when I comment the init function out it works fine.
Any ideas?
Quote Originally Posted by arteom1 View Post
You can call me a noob, but I have no idea what Im doing wrong:
I have created a new header file put the Hitboxes and bones defines in there along with the hitbox structure, then created an init function with the hitbox setups and outside the function said "Hitbox_t Hitbox[21];" for the extern. Then called the init function in my main and it did setup all the hitboxes but all my "read offset functions" now throw an access violation exceptions, when I comment the init function out it works fine.
Any ideas?
You could just do what you were doing before, just add the new ones and use the positions from the Hitboxes.
Quote Originally Posted by Chris View Post

You could just do what you were doing before, just add the new ones and use the positions from the Hitboxes.
I have tried to play around with it and now I know that it is how I declare my array I can for example declare it in the init function eg (void Init(){ Hitbox_t Hitbox[21]; ....) but then I cant extern it but the rest of the program will work fine. I think I am missing something very simple because I am all new.
Yeah that works perfectly fine, but it is not fun. Anything you can think of that I am doing wrong? My guess is that I am calling the init function wrong, all other init functions that I have are in classes "CRS->Init();". Any ideas how to do it properly, I just want to learn.
Posts 112 of 12 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Need help?