Closed Aravind-Sundararajan closed 3 years ago
Interesting. It should be pretty easy to change it. Maybe the matrix scaling is messing with it. Thanks for letting me know!
On Sun, Jun 13, 2021, 9:04 PM Aravind Sundararajan @.***> wrote:
just doing rotations about the z axis and I get skewed sprites. It looks like you're doing the rotation before the multiplication for the sprite scaling? is this intentional?
https://github.com/Aravind-Sundararajan/test_fauxton
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Gizmo199/fauxton3D/issues/1, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCQVRQCACUSAYYFO76TPZLTSVPUFANCNFSM46UKDWEQ .
I was able to get them to line up by manually multiplying the matrix components in fauxton_sprite_set() like this, but that seems pretty expensive... I'm not sure if that's what matrix_build() does behind the scenes
function fauxton_sprite_set(_x, _y, _z, _xr, _yr, _zr, _xs, _ys, _zs, _fc)
{
///@func fauxton_sprite_set(x, y, z, xrot, yrot, zrot, xscale, yscale, zscale, face_camera)
if ( !_fc )
{
var _scale = matrix_build(0, 0, 0, 0, 0, 0, _xs, -_ys, _zs);
var _rot = matrix_build(0, 0, 0, _xr, _yr, _zr, 1, 1, 1);
var _trans = matrix_build(_x, _y, _z, 0, 0, 0, 1, 1, 1);
var _final = matrix_multiply(matrix_multiply(_scale, _rot),_trans);
matrix_set(matrix_world, _final);
}
else
{
matrix_set(matrix_world, matrix_build(_x, _y, _z, _xr + (-Camera.pTo-90), 0, (Camera.Forward), _xs, _ys, _zs));
}
}
Oof. Yeah that's expensive. I will look into it some more.
On Sun, Jun 13, 2021, 9:52 PM Aravind Sundararajan @.***> wrote:
I was able to get them to line up by manually multiplying the matrix components in fauxton_sprite_set() like this, but that seems pretty expensive... I'm not sure if that's what matrix_build() does behind the scenes
function fauxton_sprite_set(_x, _y, _z, _xr, _yr, _zr, _xs, _ys, _zs, _fc) { @.*** fauxton_sprite_set(x, y, z, xrot, yrot, zrot, xscale, yscale, zscale, face_camera) if ( !_fc ) { var _scale = matrix_build(0, 0, 0, 0, 0, 0, -_xs, -_ys, -_zs); var _rot = matrix_build(0, 0, 0, _xr, _yr, _zr, 1, 1, 1); var _trans = matrix_build(_x, _y, _z, 0, 0, 0, 1, 1, 1); var _final = matrix_multiply(matrix_multiply(_scale, _rot),_trans); matrix_set(matrix_world, _final); } else { matrix_set(matrix_world, matrix_build(_x, _y, _z, _xr + (-Camera.pTo-90), 0, (Camera.Forward), _xs, _ys, _zs)); }
}
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Gizmo199/fauxton3D/issues/1#issuecomment-860330373, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGCQVRXUVGRKBXDCENFNZI3TSVVGFANCNFSM46UKDWEQ .
I have pushed this solution. This seems to be the best solution for now. I tried applying scaling directly within 'draw_sprite_ext' but it produced weird rotation issues. haha. It is quite a bit more expensive building 3 matrices so I will try to look for a better long term solution. If you only plan to have a few sprites being drawn this way, however, it shouldn't destroy performance too much. Mainly when using it for the particles there is a noticeable drop. I would probably recommend users use sPart by the snidr for actual 3D particle systems.
just doing rotations about the z axis and I get skewed sprites. It looks like you're doing the rotation before the multiplication for the sprite scaling? is this intentional?
https://github.com/Aravind-Sundararajan/test_fauxton