M
Misu
Guest
Ive gotten stuck on this for a week now and I cant bust my head on doing this properly...
Im trying to trace random spheres around an origin point but that can rotate in both x and y axis.
Ive gotten one direction moving perfectly (y axis)...
But I cant come up with one for the x axis that can adapt with the previous y axis rotation.
Ive tried several ways to work on this but I cant seem to get it working how I wanted.
This is the script thats functional for y axis (I am using d3d_draw just for placeholder until I get the mechanic working):
Any help on performing this and improving it would be great, please
Im trying to trace random spheres around an origin point but that can rotate in both x and y axis.
Ive gotten one direction moving perfectly (y axis)...
But I cant come up with one for the x axis that can adapt with the previous y axis rotation.
Ive tried several ways to work on this but I cant seem to get it working how I wanted.
This is the script thats functional for y axis (I am using d3d_draw just for placeholder until I get the mechanic working):
Code:
for(i = 0; i<360; i+=360/8)
{
xx = lengthdir_x(16,i);
yy = lengthdir_y(16,i);
zz = 20;
//////y axis
dir = floor(((i+90) mod 360)/180)*180;
rot = dx mod 360;//rotation
ang = (1-abs(floor(((i+90) mod 360)/180)*2))*rot;
//var nx = lengthdir_x(point_distance(0,0,xx,0),point_direction(0,0,xx,0));
var ny = lengthdir_y(point_distance(0,0,0,yy),point_direction(0,0,0,yy));
var nz = zz; var l1 = point_distance(0,ny,xx,yy);
var vx = ((-cos(dir*pi/180)*cos(ang*pi/180))*l1);
var vy = ny+((sin(dir*pi/180)*cos(ang*pi/180))*l1);
var vz = nz+(sin(ang*pi/180)*l1);
d3d_draw_ellipsoid(vx-1,vy-1,vz+1,vx+1,vy+1,vz-1,-1,1,1,20)
}