0 votes
Translate(targetVelocity * PlayerBody.GlobalTransform.basis); //BAD

has different results than

Translate(PlayerBody.Transform.basis * targetVelocity); //GOOD

Why is this?

I thought order didn't matter with multiplication (ex. 4x3 == 3x4)
Is it something to do with the fact its a matrix?

Enlighten me.

Godot version v4.0.beta8.mono
in Engine by (67 points)

1 Answer

+1 vote
Best answer

Yes it does matter because it is a matrix. To transform a vector by a matapplrix the matrix has to come first when you do the multiplication. Otherwise it does not make much sense. If you tried to do matrix transformation by hand you would see that.

Also multiplying two or more basis together follows this same rule, the leftmost basis is the last transformation to be applied.

by (2,017 points)
selected by

Thank you. My math skills are lacking so matrices went way over my head. Just needed to confirm that was the reason.

The documentation has a good intro to all these matrices and vectors that could help you get started.

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.