YoYoGames / GameMaker-Bugs

Public tracking for GameMaker bugs
15 stars 7 forks source link

[3D] - A positive z up-vector using matrix_build_lookat() results in an upside down view #6160

Closed Funcestor closed 1 month ago

Funcestor commented 1 month ago

Description

I don't know if this is a bug or intentional, but using matrix_build_lookat() results in an upside down view when using a positive z up-vector. As far as I can remember, in previous GM's (like GM8 or Studio 1), a positive z value used to be the z up vector. Was that changed with Studio 2?

I added the "Contact Us Package" with the sample project here: MatrixBuildLookAt_Z_UpVector.zip

There are a few ways to circumvent this problem:

Expected Change

As mentioned, I don't know if this is intentional or a bug. The expected change would be to have z-positive as up-vector

Steps To Reproduce

  1. Open GameMaker
  2. Create a Camera Object and add it to a Room
  3. Add a Draw Event with the following code:
var camera = camera_get_active();
var aspect_ratio = window_get_width() / window_get_height();

var proj_mat = matrix_build_projection_perspective_fov(60, aspect_ratio, 1, 2000);
var view_mat = matrix_build_lookat(0, 0, 200, room_width / 2, room_height / 2, 0, 0, 0, 1);

camera_set_proj_mat(camera, proj_mat);
camera_set_view_mat(camera, view_mat);

camera_apply(camera);
  1. Run the Game

Now, you obviously have to add something to the room to see the result. I added the link to the sample project in the report description.

How reliably can you recreate this issue using your steps above?

Always

Which version of GameMaker are you reporting this issue for?

2024.4.1 (Monthly)

Which platform(s) are you seeing the problem on?

Windows

Contact Us Package Attached?

Sample Project Added?

stuckie commented 1 month ago

This is not a bug. Please check the manual on how you expect the camera to operate.