Undertale Yellow script viewer

← back to main script listing

gml_GlobalScript_d3d_transform_set_rotation_axis

(view raw script w/o annotations or w/e)
1
var m;
2
function d3d_transform_set_rotation_axis(argument0, argument1, argument2, argument3) //gml_Script_d3d_transform_set_rotation_axis
3
{
4
    var c = dcos((-argument3))
5
    var s = dsin((-argument3))
6
    var omc = 1 - c
7
    var xx = argument0
8
    var yy = argument1
9
    var zz = argument2
10
    var length2 = sqr(xx) + sqr(yy) + sqr(zz)
11
    var length = sqrt(length2)
12
    xx /= length
13
    yy /= length
14
    zz /= length
15
    m[0] = omc * xx * xx + c
16
    m[1] = omc * xx * yy + s * zz
17
    m[2] = omc * xx * zz - s * yy
18
    m[3] = 0
19
    m[4] = omc * xx * yy - s * zz
20
    m[5] = omc * yy * yy + c
21
    m[6] = omc * yy * zz + s * xx
22
    m[7] = 0
23
    m[8] = omc * xx * zz + s * yy
24
    m[9] = omc * yy * zz - s * xx
25
    m[10] = omc * zz * zz + c
26
    m[11] = 0
27
    m[12] = 0
28
    m[13] = 0
29
    m[14] = 0
30
    m[15] = 1
31
    matrix_set(2, m)
32
}