vec_to_angle problems

Posted By: PurePain

vec_to_angle problems - 06/07/09 19:53

Hey, I have a problem while using vec_to_angle.
I'm trying to make an enemy aim at player all the time, but my code has got few bugs, because when player is changing his x and y position, tilt of enemy's bone is changing and when player changes his z, then pan of enemy's bone is changing, so it's kind inverted. grin


Here's my code:

vec_set(temp,player.x);
vec_sub(temp,my.x);
vec_to_angle(my.skill54,temp);
ent_bonerotate(my,"Bip01 R UpperArm",my.skill54);
if (my.skill54 > 45){my.skill54 = 45;}
ent_bonerotate(my,"Bip01 Head",my.skill54);
Posted By: PurePain

Re: vec_to_angle problems - 06/08/09 14:03

Sorry for doublepost, but does really nobody knows how to fix it?
Posted By: MDMDFSS

Re: vec_to_angle problems - 06/08/09 14:21

Try it like this:

--------------------------------------------------------------------------------
void setLimit(VECTOR* vec1, VECTOR* vec2) {
}

setLimit(vector(0,1,0), vector(0,0,0));
Posted By: PurePain

Re: vec_to_angle problems - 06/08/09 21:10

That's not it frown . Maybe I explained my problem not good enough. It looks like pan and tilt of enemy's bone have replaced their places. When my character jumps, an arm of my enemy doesn't go up, but it goes left, and when my character walks around him, enemy's arm doesn't go left and right to follow him, but it goes up (as it should be when character jumps). I hope that You can understand me better now. Could anybody please help me?
Posted By: DLively

Re: vec_to_angle problems - 06/10/09 04:42

vec_set(temp, player.x);
vec_sub(temp, my.x);
vec_to_angle(my.pan, temp);
my.tilt = 0;




this goes in enemys while action
then adjust the bones another way
Posted By: PurePain

Re: vec_to_angle problems - 06/10/09 05:59

Thanks for reply man smile You brought me a new idea, how to fully solve this. Now my.skill54 = my.z - player.z; and everything goes well. Thanks
© 2024 lite-C Forums