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

Solved help with vectors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Touric
Junior Member
Join Date: Jul 2018
Old 07-14-2018 , 07:52   help with vectors
Reply With Quote #1

hello guys, i need help with a script:
i'm trying to get the x and y of a point which is located 500 units from where i am and oriented with my eye angles:
Code:
    float clpos[3], eyeangles[3];
	GetClientAbsOrigin(client, clpos);
	GetClientEyeAngles(client, eyeangles);
	eyeangles[2] = 0.0;
	
	//now i want to get the position 500 units further from where i am with the angles of my eyes

Last edited by Touric; 07-14-2018 at 09:25.
Touric is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-14-2018 , 08:40   Re: help with vectors
Reply With Quote #2

Use ur brain! Hopefully I did it aswell, most likely my sample is right.

PHP Code:
float fPosition[3], fEyeAngles[3], fForward[3];

GetClientEyePosition(clientfPosition);

GetClientEyeAngles(clientfEyeAngles);

GetAngleVectors(fEyeAnglesfForwardNULL_VECTORNULL_VECTOR);

fPosition[0] += fForward[0] * 500.0;
fPosition[2] += fForward[2] * 500.0
mug1wara is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 07-14-2018 , 08:40   Re: help with vectors
Reply With Quote #3

PHP Code:
float distance 500.0;
float eyepos[3], eyeangles[3], direction[3], forwards[3], endpoint[3];

GetClientEyePosition(clienteyepos);
GetClientEyeAngles(clienteyeangles);

eyeangles[2] = 0.0;
eyeangles[0] = 0.0//only need this if you don't want to take pitch(x) into account and want a static yaw 500 units away from the player.

GetVectorAngles(eyeanglesdirection);  
GetAngleVectors(directionforwardsNULL_VECTORNULL_VECTOR);  

for(
int i 0;3i++)  
    
endpoint[i] = eyepos[i] + (forwards[i] * distance); 
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards is offline
Touric
Junior Member
Join Date: Jul 2018
Old 07-14-2018 , 09:24   Re: help with vectors
Reply With Quote #4

Thanks guys <3
Touric is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 07-14-2018 , 09:57   Re: help with vectors
Reply With Quote #5

No, thank you <3
mug1wara 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 09:55.


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