# slayer 64

Member Since 09 Oct 2007
Offline Last Active Mar 14 2016 12:12 AM

### circle

18 December 2015 - 09:55 PM

i'm generating some gcode for a circle, i promise, the problem is strictly math. i need to find the coordinate just before the end of my circle. i could use a direction like 359, but i need the distance from that point and the start to be 1 or 2, to be changeable. the radius of my circle could be anything.

the circle's start is always x+radius y. xy is the center of my circle.

i guess i'm trying to convert circumference to an angle.

```///generate g code

//find position before end of circle

global.gString+=

"g2 x"+string(position.x-radius)+" y"+string(position.y)+       //top half arc

"g2 x"+string(ax)+" y"+string(ay)+       //bottom half arc finishes just before the start```

04 April 2015 - 11:30 PM

i'm trying to get a shader to display something when it ray traces a plane, or display nothing. i can get the shader to draw my entire image, but i want the shader to not display a pixel when it doesn't hit the plane. anything look funny here? i'm not getting any errors, just an empty surface.

Spoiler

```varying vec2 v_vTexcoord;
varying vec4 v_vColour;

uniform vec3 vCameraPosition;
uniform vec3 vCameraForward;
uniform vec3 vCameraSide;
uniform vec3 vCameraUp;
uniform vec2 screenResolution;

void main()
{
//convert this pixel xy to a value between -1 and 1
float ax=    (2.0*v_vTexcoord.x)/screenResolution.x-1.0;
float ay=1.0-(2.0*v_vTexcoord.y)/screenResolution.y;

//convert this pixel to a vector
vec3 vRayDirection=normalize(vCameraForward+vCameraSide*ax+vCameraUp*ay);

//ray trace a flat plane
float m=(-vCameraPosition.z)/vRayDirection.z;
vec3 vIntersection=vCameraPosition+vRayDirection*m;

//float m=(-vCameraPosition.z)/vCameraForward.z;
//vec3 vIntersection=vCameraPosition+vCameraForward*m;

//check if we're in the plane
if(vIntersection.x>=0.0)
if(vIntersection.y>=0.0)
if(vIntersection.x<=100.0)
if(vIntersection.y<=100.0)
{
gl_FragColor =gl_FragColor = vec4(0,0,255,1);// v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
//return 0;
}

}
```
step event drawing to a surface
```surface_set_target(surfSomething)
draw_clear_alpha(c_black,0)
d3d_set_lighting(0)
d3dSetOrtho(screenw,screenh)

screenConvertPrep(vPosition,vForward,vUp,fov,screenw,screenh)

{
}

//draw my 320x240 background
draw_background(background3,0,0)

surface_reset_target()```

### quaternion vectors and back conversion, hard maths

28 March 2015 - 07:26 PM

i can pull three vectors off a quaternion using this script, but how can i rearrange it to go the other way? i want to set an orientation using three vectors, then i can convert to euler angles or axis angle.

i'm just not the best at rearranging math equations and i figured it can't hurt to ask.

thank you.

```///quatGetVectors(quaternion,vForward,vSide,vUp)
/*
0 quaternion
1 vForward
2 vSide
3 vUp

sets the vectors using the orientation of the quaternion. it's like calling all three quatGetVec functions at once.
*/

{
vectorx[argument1]=sqr(quaternionw[argument0])+sqr(quaternionx[argument0])-sqr(quaterniony[argument0])-sqr(quaternionz[argument0])
vectory[argument1]=(quaternionx[argument0]*quaterniony[argument0]+quaternionw[argument0]*quaternionz[argument0])*2
vectorz[argument1]=(quaternionx[argument0]*quaternionz[argument0]-quaternionw[argument0]*quaterniony[argument0])*2

vectorx[argument2]=(quaterniony[argument0]*quaternionx[argument0]-quaternionw[argument0]*quaternionz[argument0])*2
vectory[argument2]=sqr(quaternionw[argument0])-sqr(quaternionx[argument0])+sqr(quaterniony[argument0])-sqr(quaternionz[argument0])
vectorz[argument2]=(quaterniony[argument0]*quaternionz[argument0]+quaternionw[argument0]*quaternionx[argument0])*2

vectorx[argument3]=(quaternionz[argument0]*quaternionx[argument0]+quaternionw[argument0]*quaterniony[argument0])*2
vectory[argument3]=(quaternionz[argument0]*quaterniony[argument0]-quaternionw[argument0]*quaternionx[argument0])*2
vectorz[argument3]=sqr(quaternionw[argument0])-sqr(quaternionx[argument0])-sqr(quaterniony[argument0])+sqr(quaternionz[argument0])
}```

### the 1000\$ assest

21 March 2015 - 08:18 PM

what's it going to take to make a thousand dollar asset?

probably more than just setting the price

https://marketplace....1295/push-boxes

### broke, fix it

08 March 2015 - 05:05 PM

so i clicked the button to select the script i wanted and it broke. fix it. if i restart gms sometimes it fixes it.

i'm using gms 1.4.1474 stable update channel. i know i could use the bug tracker, but it's easier to post here. it's not my job bug fix gm.

yoyo should fix the resource tree refreshing all the time glitch too. these little problems add up and slow me down.