Raised This Month: $ Target: $400
 0% 

Get angle and direction


Post New Thread Reply   
 
Thread Tools Display Modes
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 12-01-2013 , 12:35   Re: Get angle and direction
Reply With Quote #11

oh. i got what u mean. when i finish my league of legends match i might take a look at it or maybe i'll take a look at it tomorrow...
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 12-01-2013 , 12:46   Re: Get angle and direction
Reply With Quote #12

Many thanks man..
GsiX is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 12-03-2013 , 11:17   Re: Get angle and direction
Reply With Quote #13

Still open for mercy from any kind soul..
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.
GsiX is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 12-03-2013 , 12:28   Re: Get angle and direction
Reply With Quote #14

is this what you meant to calculate by ccw direction?
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 12-03-2013 , 12:45   Re: Get angle and direction
Reply With Quote #15

yes left side 180 degree..
I think 360 is too much..
GsiX is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 12-03-2013 , 13:30   Re: Get angle and direction
Reply With Quote #16

i can't understand what you're trying to say. 360 is too much for what? isn't the code i wrote for you already working?
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 12-03-2013 , 13:41   Re: Get angle and direction
Reply With Quote #17

The diagram you post will fulfill my need..
Ignore the 180 and 360 bluff.. haha..

The code you post previous not return degree and always 1.6..
GsiX is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 12-03-2013 , 14:28   Re: Get angle and direction
Reply With Quote #18

really? i'll take a look at that, then... i must have done something dumb, that's why i got bad scores at geometry. also, sorry for taking too long to answer, i'm answering you in the gap between 2 lol matches.
i'll post a working version soon.
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
Bimbo1
Senior Member
Join Date: Jan 2010
Location: brazil
Old 12-03-2013 , 17:33   Re: Get angle and direction
Reply With Quote #19

Code:
stock Float:getAngleBetweenPlayerForwardAndTarget(client, target){

	decl Float:ang[3];
	GetClientEyeAngles(client, ang);
	decl Float:vec[3];
	decl Float:targetPos[3];
	GetClientAbsOrigin(client, vec);
	GetClientAbsOrigin(target, targetPos);
	decl Float:fwd[3];
	GetAngleVectors(ang, fwd, NULL_VECTOR, NULL_VECTOR);
	vec[0] = targetPos[0] - vec[0];
	vec[1] = targetPos[1] - vec[1];
	vec[2] = 0.0;
	fwd[2] = 0.0;
	NormalizeVector(fwd, fwd);
	//vec[2] = targetPos[2] - vec[2];
	ScaleVector(vec, 1/SquareRoot(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]));
	return ArcCosine(vec[0]*fwd[0]+vec[1]*fwd[1]+vec[2]*fwd[2]);

}
i did something wrong at the rotations and i'll take a look at it later. for now, take this.
__________________
sie sind das essen und wir sind die jäger!
Bimbo1 is offline
GsiX
gee, six eggs
Join Date: Aug 2012
Location: Land Below The Wind
Old 12-04-2013 , 11:08   Re: Get angle and direction
Reply With Quote #20

Hey.. your E=MCsquare is working..
I mod it a bit to suit my test..
However, the third compenent seems like annoying.. not sure if you actually disable it or not..

PHP Code:
stock Float:GetAngleBetweenVectorsubjecttarget )
{
    new 
Float:Output;
    
decl Float:ang[3];
    
decl Float:vec[3];
    
decl Float:targetPos[3];
    
GetEntPropVectorsubjectProp_Data"m_angRotation"ang );
    
GetEntPropVectorsubjectProp_Send"m_vecOrigin"vec );
    
GetEntPropVectortargetProp_Send"m_vecOrigin"targetPos );
    
    
decl Float:fwd[3];
    
GetAngleVectors(angfwdNULL_VECTORNULL_VECTOR);
    
vec[0] = targetPos[0] - vec[0];
    
vec[1] = targetPos[1] - vec[1];
    
vec[2] = 0.0;
    
fwd[2] = 0.0;
    
NormalizeVector(fwdfwd);
    
ScaleVector(vec1/SquareRoot(vec[0]*vec[0]+vec[1]*vec[1]+vec[2]*vec[2]));
    
Output ArcCosine(vec[0]*fwd[0]+vec[1]*fwd[1]+vec[2]*fwd[2]);
    
    return 
RadToDegOutput );

Anyway, million thanks...
__________________
If i happen to insulted you unintentionally,
it was me and Google Translate who did it.

Last edited by GsiX; 12-04-2013 at 11:09.
GsiX 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 07:04.


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