# How do I get local space vectors?

Attention Topic was automatically imported from the old Question2Answer platform.

For example what is Godot’s equivalent of Unity’s Vector3.up?

EDIT : No, wait, shit, I meant the equivalent of transform.up, to get the direction of a rotated object’s local up vector.

I’m not familiar with Unity at all, but according to this it’s just a shorthand notation? Godot’s uses very similar ones, take a look here: it’s `Vector3.UP`.

Not sure what this has to do with “local space” though…

The Vector3’s class constants are Godot’s global (world) directions. Vector3.UP, Vector3.FORWARD, Vector3.LEFT, etc.
Note that Unity’s forward direction is the position Z-axis while Godot’s forward direction is the negative Z-axis. The back directions are also inverted.

The local space direction of a 3D node is called Basis and it can be accessed with global_transform.basis.

• global_transform.basis.x is the local right direction.
• global_transform.basis.y is the local up direction.
• global_transform.basis.z is the local back direction.

Ok thank you, this is what I needed.

Unityfugee | 2020-04-11 18:35

Why isn´t there a linear_velocity.basis? that would be too easy i guess…
OK no seriously. How to get a linear_velocity from basis?
I want a script like:

If linear_velocity.z <= -0.2:
<= \$tracks…
<=…
<=…

But if the vehicle/object passes 90 degrees the velocity turns from - to + because its the 3d space z axis. Thats really disturbing. I hope somone can help me there.

Isswas | 2023-02-18 11:50