|
3 registered members (AndrewAMD, Grant, Neb),
908
guests, and 6
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Link entities
#402166
05/30/12 20:44
05/30/12 20:44
|
Joined: May 2012
Posts: 5
Sunshadow
OP
Newbie
|
OP
Newbie
Joined: May 2012
Posts: 5
|
Hi!
I loaded several entities (parts of a ship): ENTITY* ship_parent = ent_create... ENTITY* turret_child1 = ent_create... ENTITY* turret_child2 = ent_create...
How is it possible to treat them as a "single" entity (e.g. move and rotate the ship with all attached entities)?
Last edited by Sunshadow; 05/30/12 20:44.
|
|
|
Re: Link entities
[Re: Sunshadow]
#402171
05/30/12 21:38
05/30/12 21:38
|
Joined: Jul 2008
Posts: 2,101 Germany
rayp
 
X
|
 
X
Joined: Jul 2008
Posts: 2,101
Germany
|
Maybe... Add bones in med. where the parts should be. Example of a man with his head attached. The bone where the head is is called "Head_Pos".
function _iam_the_head()
{
VECTOR _pos;
VECTOR _ang;
while(you)
{
vec_for_bone(_pos, you, "Head_Pos");
ang_for_bone(_ang, you, "Head_Pos");
vec_set(my.x, _pos.x);
vec_set(my.pan, _ang);
wait(1);
}
ptr_remove(me);
}
//a model of a man with bones and this action applyed
action Iam_a_Man_with_Head()
{
ent_create("myhead.mdl", vector(my.x,my.y,my.z), _iam_the_head);
..
..
Helped ? mfg
Last edited by rayp; 05/30/12 21:40.
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: Link entities
[Re: rayp]
#402294
06/02/12 09:18
06/02/12 09:18
|
Joined: May 2012
Posts: 5
Sunshadow
OP
Newbie
|
OP
Newbie
Joined: May 2012
Posts: 5
|
It helped a bit ;-) I think Head_Pos is the name of a bone in the man model. Don't you need a second bone in the head model to link these bones? vec_for_bone calculates the position of the Head_Pos bone, vec_set moves the head model to the position. But which bone or origin of the head model is used as center to attach the head to the bone position?
Last edited by Sunshadow; 06/02/12 09:18.
|
|
|
Re: Link entities
[Re: Sunshadow]
#402405
06/04/12 14:14
06/04/12 14:14
|
Joined: Jul 2008
Posts: 2,101 Germany
rayp
 
X
|
 
X
Joined: Jul 2008
Posts: 2,101
Germany
|
I think Head_Pos is the name of a bone in the man model.
yes as i said. Don't you need a second bone in the head model to link these bones? - But which bone or origin of the head model is used as center to attach the head to the bone position? No. In this example the model origin is used to "connect" in the head model. You can add a bone to head model and then setting its pos via vec_set (i think). But its nearly the same.
Last edited by rayp; 06/04/12 14:16.
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: Link entities
[Re: Realspawn]
#412342
11/26/12 07:58
11/26/12 07:58
|
Joined: Jul 2008
Posts: 2,101 Germany
rayp
 
X
|
 
X
Joined: Jul 2008
Posts: 2,101
Germany
|
example vertex
function linked_model()
{
VECTOR _p;
while(you)
{
vec_for_vertex(_p, you, 123);
vec_set(my.x, _p.x);
wait(1);
}
}
action A_Model()
{
..
ent_create("head.mdl", nullvector, linked_model);
..
}
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;
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|