Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Link entities #402166
05/30/12 20:44
05/30/12 20:44
Joined: May 2012
Posts: 5
S
Sunshadow Offline OP
Newbie
Sunshadow  Offline OP
Newbie
S

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 Offline

X
rayp  Offline

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".

Code:
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
S
Sunshadow Offline OP
Newbie
Sunshadow  Offline OP
Newbie
S

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 Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,101
Germany
Quote:
I think Head_Pos is the name of a bone in the man model.
yes as i said.

Quote:
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: rayp] #402407
06/04/12 14:16
06/04/12 14:16
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
You could also use vertex- or relative positions, that *might* be easier than using bones laugh

Re: Link entities [Re: Rei_Ayanami] #412329
11/25/12 21:40
11/25/12 21:40
Joined: Jul 2001
Posts: 4,801
netherlands
Realspawn Offline

Expert
Realspawn  Offline

Expert

Joined: Jul 2001
Posts: 4,801
netherlands
example ? laugh


Find all my tutorials & Workshops at : www.rp-interactive.nl

Creativity starts in the brain
Re: Link entities [Re: Realspawn] #412342
11/26/12 07:58
11/26/12 07:58
Joined: Jul 2008
Posts: 2,101
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,101
Germany
example vertex
Code:
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;

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1