How do I offset something reletive to an entitys..

Posted By: RyuShinji

How do I offset something reletive to an entitys.. - 04/07/08 12:50

How do I offset something reletive to an entitys pan?

I want to put a sword on my players back for example, but the origin is on the handle of the sword, how can i move it right a bit in other words, how can i change its y pos relitive to the players y depending on the players pan..?

I want to offset the sword to the right by say 10, here is my current code:
vec_for_vertex(my.X,you,134); // get position of weapon
vec_set(my.pan,you.pan); // set pan to owner's pan
my.pan -= 90; // adjust weapon so player can see it better
my.tilt += 45; // adjust weapon so player can see it better
Posted By: Anonymous

Re: How do I offset something reletive to an entitys.. - 04/07/08 17:22

vec_set(temp,vector(0,5,0)
vec_for_vertex(my,temp2,134);
vec_add(temp,temp2);
vec_add(temp,player.x);
vec_set(my.pan,you,pan);


Does this work???
Posted By: Xarthor

Re: How do I offset something reletive to an entitys.. - 04/07/08 19:02

If you want to attach the sword to a certain vertex this instruction should do the job:
vec_for_vertex(sword.x,player,1234);
vec_set(sword.pan,player.pan);

If you have a certain offset (stored in the sword's skills) you could use this approach:
vec_set(temp.x,sword.offset_x);
vec_rotate(temp.x,player.pan);
vec_add(temp.x,player.x);
vec_set(sword.x,temp.x);
vec_set(sword.pan,player.pan);
© 2024 lite-C Forums