Why Does Vector3d's FORWARD Constant Take -1 as 'z' Value?

Godot Version

4.3 Stable

Question

` I am following the “Squash the Creeps” project step by step and while scripting player movement, we set ‘z’ direction value to “-1” in order to make the player move forward.

I ctrl+clicked the Vector3D component and indeed it says “FORWARD = Vector3(0, 0, -1)” so the ‘z’ parameter is, indeed, -1 for forward movement. But why?

I understand 2D space, as 0, 0 on a monitor starts from the top-left corner so as you go down, y value increases. This makes sense. But why is this a thing in 3D space? Could someone please clarify this? Thanks a lot in advance and have a nice day! `

In godot -z is the forward direction (in 3D) that’s why probably

This might help you: Using 3D transforms — Godot Engine (stable) documentation in English

So was it just an arbitrary decision? Could they just as well pick +z as forward direction and if so, why didn’t they? I read the documentation page you linked to but it doesn’t say anything about why -z was chosen as forward direction.

The documentation even says: “Imagine you need to shoot a bullet in the direction your player is facing. Just use the forward axis (commonly Z or -Z).”

So they could in fact choose z as forward direction but they didn’t and my funny brain wants to know why :smiley:

Yes infact they could have chosen anything as the forward direction.
AFAIK Godot only used to have OpenGL for rendering before. So they adapted their directions as it says in the docs

Following the OpenGL convention, X is the Right axis, Y is the Up axis and Z is the Forward axis.

1 Like

Well, I guess it’s one of those conventions that you stop questioning and just accept :smiley:

I have my answer, thank you good sir/ma’m and have an amazing day!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.