B
boowee
Guest
Hi,
Fairly new to GM and coding and I am trying to rotate the camera based on which direction the player is facing, but I must be thinking about this the wrong way and it might be a stupid question.
To do this I am trying to define the up vector for the camera based on the players image_angle.
This is the code I have now, which is basically not doing anything but the idea was to create a vector between the player and a point in its facing direction:
----------------------------------------------------------------------------
xUp = oPlayer.x - lengthdir_x(100, oPlayer.image_angle)
yUp = oPlayer.y - lengthdir_y(100, oPlayer.image_angle)
var vm = matrix_build_lookat(x,y,-10,x, y,0,xUp,yUp,0);
camera_set_view_mat(camera,vm)
----------------------------------------------------------------------------
This should probably be done in a completely different way but I would appreciate any pointers or help on this.
Thanks!
Fairly new to GM and coding and I am trying to rotate the camera based on which direction the player is facing, but I must be thinking about this the wrong way and it might be a stupid question.
To do this I am trying to define the up vector for the camera based on the players image_angle.
This is the code I have now, which is basically not doing anything but the idea was to create a vector between the player and a point in its facing direction:
----------------------------------------------------------------------------
xUp = oPlayer.x - lengthdir_x(100, oPlayer.image_angle)
yUp = oPlayer.y - lengthdir_y(100, oPlayer.image_angle)
var vm = matrix_build_lookat(x,y,-10,x, y,0,xUp,yUp,0);
camera_set_view_mat(camera,vm)
----------------------------------------------------------------------------
This should probably be done in a completely different way but I would appreciate any pointers or help on this.
Thanks!