This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hello, I'm about to start work translating my gdscript 2D platformer character code to 3D and I was hoping to get some advice on any major differences. Some questions I have are:

Are the built in functions used differently for kinematic movement in 3D vs 2D?
Are there any major mathematical differences?
Is integrating the local forward vector into movement difficult?

Any and all advice would be helpful.

Godot version 3.2.1
in Engine by (15 points)

1 Answer

+1 vote
Best answer

You'll find that the kinematic functions are the same: move_and_slide(), etc., and work in much the same way. You'll be using Vector3 instead of Vector2.

However, being in 3 dimensions does introduce an additional level of mathematical complexity, especially when it comes to rotations. In 2D, there is only one axis of rotation, while in 3D there are infinitely many.

Your object's position/rotation/scale are stored in a Transform, which contains an origin (location) and a basis (rotation/scale). You'll use the transform.basis to get the object's local axis vectors. For example, the forward vector of a 3D object is -transform.basis.z.

There's a good overview doc here:

by (22,191 points)
selected by

Thanks for the prompt answer. The info you gave is really good and the article is super complete. I'll study that article in more detail soon.

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.