Raised This Month: $51 Target: $400
 12% 

moving entity depending on players angle


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ahujenas
Junior Member
Join Date: Oct 2006
Old 09-25-2012 , 09:58   moving entity depending on players angle
Reply With Quote #1

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;
				//origin[2]-=0.8;
					origin[0] += ( -3.5 * floatsin( -angle, degrees) ),
					origin[2] += ( -0.8 * floatcos( -angle, degrees) ),
					entity_set_origin(KaiokenCharge[id], origin);
according to everything, this should move the current entity where the player rotates at the exact angle everytime,but it just sticks it into players waist ( 0,0,0 coordinates ) should I establish the angle also for this to take effect?
ahujenas is offline
ahujenas
Junior Member
Join Date: Oct 2006
Old 09-29-2012 , 12:40   Re: moving entity depending on players angle
Reply With Quote #2

Any help?..

edit: in other words, i want to attach the object to players hands, but im doing it by setting its origin from angle ( doesn't work out very well )

p.s i CAN attach it, but I first have to create it in the offset I want it to be

Last edited by ahujenas; 09-29-2012 at 12:41.
ahujenas is offline
dias
BANNED
Join Date: Jul 2009
Location: South Vietnam
Old 09-30-2012 , 01:45   Re: moving entity depending on players angle
Reply With Quote #3

Should be Velocity ?
dias is offline
Send a message via Yahoo to dias Send a message via Skype™ to dias
ahujenas
Junior Member
Join Date: Oct 2006
Old 10-02-2012 , 08:47   Re: moving entity depending on players angle
Reply With Quote #4

What do you mean? I've tried doing this in a different way, but it returns 0 after vec normalize

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]);
ahujenas is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 23:04.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode