2 registered members (AndrewAMD, Ayumi),
838
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Enemies to hold guns
[Re: mschoenhals]
#429602
09/14/13 22:49
09/14/13 22:49
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
In MED: If your models have bones. Open your player model and merge the gun model ( file/merge ). Select a bone and switch into "Apply Vertices Mode". Select the vertices of your gun and press the "Apply vertices" button ( framerange should be setup to all frames ). If you want to do it by script this could look like this
void hold_gun(){ //me = a gun, you = player
..
while (me && you){
VECTOR _a, _p;
vec_for_bone (_p, you, "BoneName");//xyz pos of bone
ang_for_bone (_a, you, "BoneName");//pan,tilt,roll of bone
vec_set (my.x, _p.x); //set xyz
vec_set (my.pan, _a); //set pan...
wait (1);
}
..
}
Cheers
Last edited by rayp; 09/14/13 22:57.
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: Enemies to hold guns
[Re: mschoenhals]
#429605
09/14/13 23:07
09/14/13 23:07
|
Joined: Jul 2008
Posts: 2,107 Germany
rayp
X
|
X
Joined: Jul 2008
Posts: 2,107
Germany
|
Then the only thing i can imagine right now would be a workaround with maybe Except of that i have no idea sry. edit: I assume u switched into "Bones" Mode before ?
Last edited by rayp; 09/15/13 00:01. Reason: see edit
Acknex umgibt uns...zwischen Dir, mir, dem Stein dort... "Hey Griswold ... where u gonna put a tree that big ?" 1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected rayp.flags |= UNTOUCHABLE;
|
|
|
Re: Enemies to hold guns
[Re: rayp]
#429632
09/15/13 18:16
09/15/13 18:16
|
Joined: Aug 2008
Posts: 408 mi usa
sadsack
Senior Member
|
Senior Member
Joined: Aug 2008
Posts: 408
mi usa
|
bones are good, no bone no buy
I have A7 Commercial .............. Now I just need to learn how to use it
|
|
|
Re: Enemies to hold guns
[Re: rayp]
#429837
09/19/13 09:14
09/19/13 09:14
|
Joined: Jan 2006
Posts: 968
EpsiloN
User
|
User
Joined: Jan 2006
Posts: 968
|
Then the only thing i can imagine right now would be a workaround with maybe Use vec_for_vertex twice for 2 vertices, then substract the two vectors (vec_sub) to get the direction from one vector to another and align the gun using the resulting vector.
vec_for_vertex(tmppos1.x,tmp_parent,vertnum);
vec_set(my.x,tmppos1.x);
vec_for_vertex(tmppos2.x,tmp_parent,vert2num);
vec_sub(tmppos2.x,my.x);
vec_to_angle(my.pan,tmppos2.x);
Thats an example of one of my old projects, I modified the vector/variable names so you can understand what is what. After the vec_to_angle you might have to add to pan or tilt to get the right alignment of the gun (depends of MED). PS.: Dont be afraid to use vec_for_vertex and no-bones models for start, you can later change them with bone models without much coding.(If you make it clean)
|
|
|
|