Math Class. Getting coordinates in front of the player.
Posted: September 2nd, 2012, 4:18 pm
I want to share this snippet, because it took some hours from my life, to solve this simple Math problem.
With this script, you can get the position in front of you, from your angles.
front = anglesToForward( self getplayerangles() );
front = (front[0] * 50, front[1] * 50, front[2] * 50);
trace = bulletTrace( self.origin, front, false, self );
iprintlnbold(trace["position"]);
I used it for a gravity gun. You get bounce, from the front everywhere.
http://www.xfire.com/video/5a7cce/
Greetings
With this script, you can get the position in front of you, from your angles.
front = anglesToForward( self getplayerangles() );
front = (front[0] * 50, front[1] * 50, front[2] * 50);
trace = bulletTrace( self.origin, front, false, self );
iprintlnbold(trace["position"]);
I used it for a gravity gun. You get bounce, from the front everywhere.
http://www.xfire.com/video/5a7cce/
Greetings