Gamestudio Links
Zorro Links
Newest Posts
Alpaca Plugin v1.5.2 Release
by kzhao. 01/11/26 13:42
Alpaca Plugin v1.4.0
by kzhao. 01/11/26 13:38
separating groups of 3 digits by a comma
by joe_kane. 01/11/26 00:01
MRC.c and WFO
by joe_kane. 01/10/26 23:58
BarOffset (default = 940 for daily bars?
by joe_kane. 01/10/26 23:46
NOMAX undeclared identifier.
by Petra. 01/09/26 21:12
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (kzhao, 1 invisible), 3,723 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
joe_kane, Namitha_NN, Syndrela, agasior, mosfet
19189 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Positioning an entity in a position relative to another entity #288581
09/07/09 14:24
09/07/09 14:24
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline OP
Serious User
painkiller  Offline OP
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Hi, what code i can do for positioning an entity in a position always relative to another entity, laso when the second entity is moving?

Last edited by painkiller; 09/07/09 14:24.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Positioning an entity in a position relative to another enti [Re: painkiller] #288586
09/07/09 14:36
09/07/09 14:36
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Something like that:

action keep_me_in_dist()
{
my.skill1 = handle(you); // get the pointer from somewhere
while(1)
{
you = ptr_for_handle(my.skill1);
vec_set(my.skill2,vector(20,33,5)); // play with these values
vec_rotate(my.skill2,you.pan);
vec_add(my.x,my.skill2);
wait(1);
}
}

The offset is depended from the "another" entities angle; if you dont want that, remove the vec_rotate.

Re: Positioning an entity in a position relative to another enti [Re: the_clown] #288648
09/07/09 19:50
09/07/09 19:50
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline OP
Serious User
painkiller  Offline OP
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
thanks, but i don't understand very well the code, can you explain it me?


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Positioning an entity in a position relative to another enti [Re: painkiller] #288688
09/08/09 06:15
09/08/09 06:15
Joined: Nov 2008
Posts: 946
T
the_clown Offline
User
the_clown  Offline
User
T

Joined: Nov 2008
Posts: 946
Well, look up the single functions in the almighty manual, there they are explained very well. wink

Re: Positioning an entity in a position relative to another enti [Re: the_clown] #288742
09/08/09 11:41
09/08/09 11:41
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline OP
Serious User
painkiller  Offline OP
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
thanks again


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Positioning an entity in a position relative to another enti [Re: painkiller] #288822
09/08/09 21:30
09/08/09 21:30
Joined: Jul 2009
Posts: 39
Chile!
Renard Offline
Newbie
Renard  Offline
Newbie

Joined: Jul 2009
Posts: 39
Chile!
Look, this is the code I`m using for attaching a gun to my model.

STRING Gatlin_mdl = "Gatlin.mdl";
function Gatlin()

{
proc_mode = PROC_LATE;
set(my,PASSABLE); // the Gatlin shouldn't slow down the player
while (player == NULL){wait (1);}//wait ´till the player is created.
while(1)
{
vec_for_vertex (my.skill1, you, 1446);
vec_for_vertex (my.skill4, you, 1447); //vertex on the model hand


vec_diff (my.skill7, my.skill4, my.skill1);// compute the vector that will be used by the Gatlin
vec_to_angle (my.pan, my.skill7); // rotate the Gatlin accordingly

// put the origin of the Gatlin in the vertex that is placed at the bottom of the arm
vec_set (my.x, my.skill1);
wait (1);
}
}


AND you need to add a line on the character code, to ent_create the model to attach and call the function.
BUT, this is going to attach the models nicely, but it can cause some issues depending on your player`s code.

Last edited by Renard; 09/08/09 21:36.

WRYYYYYYYYYYYYYYYYYY!!!1!!ONE!!11
Re: Positioning an entity in a position relative to another enti [Re: Renard] #288898
09/09/09 10:29
09/09/09 10:29
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline OP
Serious User
painkiller  Offline OP
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
thanks, i haven't problem because i use the physics engine, then i put the another entity as passable and there won´t be problems


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | 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