2

I have a question about Raylib.

I managed to move my player using Key_Down.

But now, I want to change the direction of my player by using Key_Up, Key_Down, Key_Right and Key_Left.

I have understand that I need to move my player around an X axis. I try to do it with the

DrawModelEx(model, position, (Vector3){ 1.0f, 1.0f, 1.0f }, -90.0f, (Vector3){ 0.025f, 0.025f, 0.025f }, WHITE);

I have already try to change the parameters of the DrawModelEx function by I think that it is not a good idea.

I have heard that I need to use the Struct Matrix but I don't understand how it works.

Thank you for your answers

1 Answers1

3

Third parameter of DrawModelEx is rotation-axis vector - this vector defines, on whics axis your object will be rotated. To rotate along X axis:

DrawModelEx(model, position, (Vector3){ 1.0f, 0.0f, 0.0f }, -90.0f, (Vector3){ 0.025f, 0.025f, 0.025f }, WHITE);

Third parameter of Vector is X axis, second is Y, third is Z. If you wanna rotate along, for example, Y axis, change vector definition to (Vector3){0.0f, 1.0f, 0.0f}, and so on. P.S. I'm not sure, if it's allowed to rotate on negative degree, but you can try this.