Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
0 registered members (), 18,008 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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