|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
detecting hit location
#8959
05/04/02 09:10
05/04/02 09:10
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
How can I detect where a character was hit? Specifically, I'ld like to have characters react differently when hit in their torso, in one of their limbs, or a head shot. -Joe Hocking www.3darteest.com
|
|
|
Re: detecting hit location
#8960
05/07/02 06:32
05/07/02 06:32
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Hi jhocking; try looking at the traget room script in the techdemo and note how he positions the hull size locations to display the targets messages when the targets are hit in a specific place. ![[Roll Eyes]](images/icons/rolleyes.gif)
|
|
|
Re: detecting hit location
#8961
05/08/02 04:35
05/08/02 04:35
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
Thanks for the info, but unless I am mistaken (and I very well may be; the techdemo code is pretty convoluted) the techdemo code is merely blocking out areas of the static targets.
However, I am asking about moving characters. For example, I want to be able to detect shots that hit characters' arms. However, enemies move their arms around when walking, running, attacking, etc. Meanwhile, the enemies can also stand, crouch, or lie down.
|
|
|
Re: detecting hit location
#8963
05/08/02 05:00
05/08/02 05:00
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
By "vertex attach" what do you mean? If you mean use vec_for_vertex to figure out the vertex position, and then move the box there every frame, how do I associate a given box to its model? That is, how do I make the character react when the box is hit?
For example, if I use "trace" to determine where a shot hits, the command will set "you" to the box. How do I then transfer information that the character was hit to the character's entity?
|
|
|
Re: detecting hit location
#8964
05/08/02 05:12
05/08/02 05:12
|
Joined: Mar 2002
Posts: 1,123 California
Cellulaer
Expert
|
Expert
Joined: Mar 2002
Posts: 1,123
California
|
//From the attach weapon to character on the resource site (no animation frames) create(<agentg.mdl>,nullvector,vertex_attach);
var hand_pos[3] = 0,0,0;
function vertex_attach { my.passable = on; while(you){ // weapon will always "face" the second vertice from vec_for_vertex(my.x,you,5); //vertice at "pinky" side of palm vec_for_vertex(hand_pos.x,you,17); //vertice between thumb and pointer finger temp.x = hand_pos.x - MY.X; temp.y = hand_pos.y - MY.Y; temp.z = hand_pos.z - MY.Z; result = vec_to_angle(my_angle,temp); my.pan = my_angle.pan; my.tilt = my_angle.tilt; my.roll = my_angle.roll; wait(1);} }
-OR-
//From animate.wdl and attaching an entity to a vertex (animation frames required) ent_create(agent_mdl,nullvector,attach_entity);
///////////////////////////////////////////////////////////////////////// // Desc: attaches an entity that has the same origin and the same frame cycles // function attach_entity() { my.passable = on; while(you) // prevent empty synoym error if parent entity was removed { if(your.shadow == on) { my.shadow = on; } if(you == player && person_3rd == 0) { my.invisible = on; } else { my.invisible = off; }
vec_set(my.x,you.x); vec_set(my.pan,you.pan); my.frame = you.frame; my.next_frame = you.next_frame; wait(1); } remove(my); }
|
|
|
Re: detecting hit location
#8965
05/12/02 03:35
05/12/02 03:35
|
Anonymous
OP
Unregistered
|
Anonymous
OP
Unregistered
|
I agree with you Noah. It is a good solution to use vec_for_vertex to attach an invisible block to the entity you are shooting at. I.E. you can attach a small block to the head of the entity and if this block is hit by a bullet (event_shoot) then you can program an event that changes skin(with blood on) or emits blood particles on that area.
|
|
|
|