+1 vote

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.

asked Apr 11 in Engine by Unityfugee (21 points)
edited Apr 11 by Unityfugee

2 Answers

+3 votes
Best answer

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.
answered Apr 11 by hammeron (146 points)
selected Apr 11 by Unityfugee

Ok thank you, this is what I needed.

+1 vote

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...

answered Apr 11 by njamster (9,950 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.