Originally Posted By: 3run
Hi there!

a quote from the manual:
Quote:
For detecting which limb of an actor entity was hit, use the vertex number from the hit struct and retrieve the bone name with the ent_bonename function.

Take a look here:
c_trace
ent_bonename

Edit: gonna make an example, please wait


Edit2: please, take a look at this example (used guard model from my contribution):
Code:
#include <acknex.h>
#include <default.c>

#define PRAGMA_POINTER

void main(){
	
	warn_level = 6;
	fps_max = 60;
	
	level_load("");
	
	vec_set(&camera->x, vector(152, 0, 43));
	vec_set(&camera->pan, vector(180, -15, 0));
	
	def_move();
	
	ENTITY *guard_ent = ent_create("guard.mdl", nullvector, NULL);
	set(guard_ent, POLYGON);
	
	while(guard_ent){
		
		VECTOR temp;
		vec_set(&temp, vector(1024, 0, 0));
		vec_rotate(&temp, &camera->pan);
		vec_add(&temp, &camera->x);
		
		draw_point3d(&temp, COLOR_RED, 100, 4);
		
		c_trace(&camera->x, &temp, IGNORE_PASSABLE | SCAN_TEXTURE);
		
		if(trace_hit){
			
			draw_point3d(&hit->x, COLOR_RED, 100, 4);
			
			if(you){
				
				STRING *bone_name_str = "";
				ent_bonename(you, bone_name_str, hit->vertex);
				draw_text(bone_name_str, 10, 40, COLOR_WHITE);
				DEBUG_VAR(hit->vertex, 10);
				
			}
			
		}
		
		wait(1);
		
	}
	
}

It will display the bone, closest to the 'hit.x' position.


Edit3: if you want to check, which limb was hit (f.e. wanted to create hitboxes or such, to detect headshots etc), I would suggest you to use Superku's solution. You can find it in AUM 103, here. It's going to be faster.

Greets!


Thanks a lot ! Turns out that i forgot to set the POLYGON flag. That is why it was always showing the same bone.