• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

[RESOLVED]GMS 1.4.x: 3D - how can i rotate on same position?

C

cambalinho

Guest
on Draw event:
Code:
d3d_transform_set_rotation_y(angle);
d3d_transform_add_translation(x,y,100);
d3d_draw_ellipsoid(0,0,100,(0+100),(0+100),100+100,sprite_get_texture(sprDiamond,0),1,1,50);
d3d_transform_set_identity();
but the draw picture is always change it's position.
so how can i rotate on it's center?
 
C

cambalinho

Guest
after doing more tests i did it:
Code:
d3d_transform_add_rotation_z(angle);
    d3d_transform_add_translation(x,y,200);
    d3d_draw_ellipsoid(-50,-50,-50,50,50,50,sprite_get_texture(sprDiamond,0),1,1,50);
    d3d_transform_set_identity();
thank you so much.
correct me anotherthing that i'm confused: what is the diference between the direction and z rotation?
(seems that sometimes i can fail on some situations, because i need some explication)
 
C

cambalinho

Guest
thank you so much
but i need another correction: sepaking on d3d_transform functions names, what is the diference between 'set' and 'add'?
 
Last edited by a moderator:
I

icuurd12b42

Guest
set will reset all transforms stack.. think of it like combining
d3d_transform_set_identity() (nuke transforms and submit draw buffer) and a d3d_transform_add_XXX() (add transform)
but it wont (I think) reset the draw buffer to a new batch like set_identity would
 
C

cambalinho

Guest
so why i need ...add_rotation_x and ....set_rotation_x?
maybe for draw several diferent images, but changing the rotation?
 
I

icuurd12b42

Guest
add_rotation
draw //draws at angle above
add_rotation
draw //draw at angle above + angle prior
set_identity //submit the batch


set_rotation
draw //draws at angle above
set_rotation
draw //draw at angle above
set_identity //submit the batch

add_rotation
draw //draws at angle above
set_identity //submit the batch
add_rotation
draw //draw at angle above
set_identity //submit the batch
 
Top