View Full Version: point_direction_3d

GameMaker3d > 3d Scripts > point_direction_3d


Title: point_direction_3d
Description: find the zdirection between 2 3D points


brett14 - November 3, 2009 01:58 AM (GMT)
Returns the zdirection between two 3D points (In degrees). This is now tested, credit is optional.
CODE
/*
[X1,Y1,Z1,X2,Y2,Z2] RETURNS IN RADIANS
*/
return arctan2(argument5-argument2,point_distance(argument0,argument1,argument3,argument4));

Goldy - November 3, 2009 02:37 PM (GMT)
that didnt work. I think i missed the z control for the first math part. i'll add that when i get home

brett14 - November 5, 2009 12:00 AM (GMT)
I'll make another, but check it this time. I'll upload it here later

Goldy - November 29, 2009 10:11 AM (GMT)
3d point direction script found, thanx to icuurd for his explanation on the gmc forums. ill post link when im on computer.

point_direction_3d(xfrom,yfrom,zfrom,xto,yto,zto)
CODE
d3d_transform_add_rotation_y(point_direction(point_distance(argument0,argument1,argument3,argument4),argument5,0,argument2)+90)
d3d_transform_add_rotation_z(point_direction(argument0,argument1,argument3,argument4)-180)

Goldy - December 1, 2009 02:00 AM (GMT)
thanx brett to move it here.

Goldy - March 27, 2010 07:11 AM (GMT)
[Edited by: Brett14]
fixed in top post.

brett14 - March 28, 2010 07:38 AM (GMT)
How are you using it, like show me the code your using, I used it in my game and it worked fine

Goldy - May 27, 2010 02:17 AM (GMT)
Late Reply

I used it as d3d_point_direction(x,y,z,target.x,target.y,target.z). I typed the codes from this phone since i had no connection to the com. I may have a typo in it. I'll type it again, and will look over it.

brett14 - June 19, 2010 09:51 PM (GMT)
fixed completely, apparently I was using it wrong before.

brett14 - July 22, 2010 10:36 PM (GMT)
Made more efficient




Hosted for free by InvisionFree