How do I make translate move in a consistent direction?

Godot Version

4.2

Question

This CharacterBody3D is supposed to move forward on its local Z axis, but moves up and backwards after pitching up. This happens with both
translate_object_local(+transform.basis.z)
and
translate(+transform.basis.z)
translate_object_local_cobra

One thing to keep in mind the Forward direction is negative in 3D space and the transform.basis.z is positive when pointing in the Forward z direction.

Vector3.FORWARD == Vector3(0 ,0 ,-1)
Basis.IDENTITY.z == Vector3 (0 ,0 ,1)

If you want to translate forward vector to the director of your object z basis, just vector*basis to translate it.

When you pitch the plane the basis z changes in the y direction.

Basis.z == Vector3 (0,.1,.8) # pitch up this is a normalized value
Basis.z == Vector3 (0,-.1,.8) # pitch down

The basis describes the rotation of your object.

To always go ‘Forward’ I would do this:

global_position += Vector3.FORWARD * global_transform.basis * distance_scaler

You can use translate functions too they are the same thing