Get the angle of a line between two origins
I am trying to get the angle of a line between 2 origins. I have searched and tried quite a few ways but nothing is working for me. I was able to get the angle of my aim using pev_v_angle but that will only return the angle I am currently aiming; I need it to compute the angle based on 2 inputted origins. Is there a way to do this?
Example, I would need the angle of the line shown below (would prob be ~45 degree or so) http://img.photobucket.com/albums/v2...rona/angle.jpg Among a few other ways, I've tried using fm_get_view_angle_diff() and the below code with no luck. PHP Code:
|
Re: Get the angle of a line between two origins
EDIT: Nvm.
Here is how I found the angle between 2 vectors in my Pre-Calculus class: Code:
Here is an example of the angle between a player's aim direction and their movement: Code:
Note: The angle will always be 0 - 180 in degrees, 0 - pi in radians, etc. |
Re: Get the angle of a line between two origins
Code:
new Float:fOrigin1[3] |
Re: Get the angle of a line between two origins
Quote:
I put it into a function to return 89 when aiming straight up, 0 when aiming perfectly straight, and -89 aiming straight down (when the aiming players origin is passed as first origin param). For anyone else that needs this: PHP Code:
PHP Code:
|
| All times are GMT -4. The time now is 17:07. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.