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
Math Class. Getting coordinates in front of the player.
Moderator: Core Staff
Math Class. Getting coordinates in front of the player.
Last edited by Creep on September 2nd, 2012, 6:20 pm, edited 1 time in total.
Re: Math Class. Getting coordinates in front of the player.
it is pretty simple, but you have one thing messed up:Creep wrote: front = anglesToForward( self getplayerangles() );
vec = (front[0] * 50, front[1] * 50, front[2] * 50);
trace = bulletTrace( self.origin, front, false, self );
iprintlnbold(trace["position"]);
trace = bulletTrace( self.origin, front, false, self );
should be:
trace = bulletTrace( self.origin, self.origin + vec, false, self );
Re: Math Class. Getting coordinates in front of the player.
Oups, I used function in my script and the vec variable doesn't exist in this version.Nekoneko wrote: it is pretty simple, but you have one thing messed up:
trace = bulletTrace( self.origin, front, false, self );
should be:
trace = bulletTrace( self.origin, self.origin + vec, false, self );
I've corrected it, the second line is for 'front' variable.
Yes it's simple, but I'm not familiar with cod2 script functions, yet
Thanks
Who is online
Users browsing this forum: No registered users and 1 guest