setting origin from angle.. (kinda)

New Member
Joined
Oct 8, 2011
Messages
21
Best answers
0
Well, I'm trying to set the sprites origin in the players hands using the players facing angle to PUT it in there, but I can't get the formula to do it :mad:

I've tried some of my past used formulas in .AMX where I used to create an explosion infront of player in any angle he turns

Code:
new Float:origin[3];
					new Float:angle[3];
					entity_get_vector(id,EV_VEC_origin,origin);
					entity_get_vector(id,EV_VEC_angles,angle);
					origin[0] += ( -3.5 * floatsin( -angle, degrees) ),
					origin[2] += ( -0.8 * floatcos( -angle, degrees) ),
					entity_set_origin(KaiokenCharge[id], origin);
I have this fornow, but the calculation returns 0 all the time, I've tried doing different ways, but it doesn't create the sprite in his hands.. Can anyone help me?

P.S the code is what I started with cause other code I wrote didn't work
 
NOT IN THE MANGA™
★ Black Lounger ★
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Jan 5, 2008
Messages
3,276
Best answers
0
In player's hands? What exactly are you doing?
 
Freelance Mappzor
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Nov 21, 2003
Messages
17,065
Best answers
0
My guess. And attack charge sprite or something like that.
 
NOT IN THE MANGA™
★ Black Lounger ★
✔️ HL Verified
🚂 Steam Linked
💻 Oldtimer
Joined
Jan 5, 2008
Messages
3,276
Best answers
0
You didn't understand. I need more details.

I can't help you with this question exactly but I thought that if you gave me more details on what you want to do exactly, maybe I could suggest you some other, possibly better way.

I wanted to suggest you using one of the default ESF's attacks in which the attack is charged in the hand and simply alter its sprite. But I don't know if it makes sense without knowing what you're doing.
 
Last edited:
New Member
Joined
Nov 24, 2001
Messages
692
Best answers
0
In ESF 1.2 all characters have a beam attachment on their hand (I think it's attachment 1 or 2). So you should be able to grab the position of that attachment, dunno how to do that in AMX script though.
 
New Member
Joined
Oct 8, 2011
Messages
21
Best answers
0
Basically, I'm trying to create a charge sprite in the player's hands, but I can create it in his hands only when his angle is 0 (thats how i got the offsets in the first place), When player's angle isn't 0, with those offsets it will create somewhere behind him/other side of player and etc.
 
New Member
Joined
Oct 8, 2011
Messages
21
Best answers
0
Code:
static Float:aim[3],Float:vec[3],Float:endvec[3],Float:origin[3];
					fm_get_aim_origin( id, aim );

					pev(id,pev_origin, origin );
					client_print(id,print_chat,"origin %0.f %0.f %0.f",origin[0],origin[1],origin[2]);
					xs_vec_sub(aim,origin, vec );
					client_print(id,print_chat,"vec %0.f %0.f %0.f",vec[0],vec[1],vec[2]);
					xs_vec_normalize(vec,endvec);
					client_print(id,print_chat,"normalized %0.f %0.f %0.f",endvec[0],endvec[1],endvec[2]);
here is what I have now, the endvec returns 0 or -0 somewhy, what could be wrong?:(
 
Project Manager
🌠 Staff
✔️ HL Verified
💻 Oldtimer
Joined
Nov 25, 2001
Messages
1,729
Best answers
0
it looks alright from what I can see, given that the functions do what I think they are doing, are all the debug prints returning what they are supposed to return ?
Or to be more specific does "vec" return the correct non-normalized direction `?
 
New Member
Joined
Oct 8, 2011
Messages
21
Best answers
0
Well, it does return something, I haven't tried tried debugging if the vec direction is alright. I've tried calculating the normalized vec myself, using xs_vec_normalize formulas in XS.inc file, It calculates fine for me, but it doesn't in the script.
 
New Member
Joined
Oct 8, 2011
Messages
21
Best answers
0
Well, I've got this to work, but the question still stands, how do I get the correct offsets from angles? (vec normalizing returns something now below 1)
 
New Member
✔️ HL Verified
Joined
Nov 25, 2010
Messages
46
Best answers
0
The origins from the x keep returning 0. we have gotten the Y to move but the X still remains. I believe something might be wrong with sinus in amxx but we are not sure. all other attempts at other formulas have also failed. does any one have any ideas ?
 

Users who are viewing this thread

Top