Skip to content

Instantly share code, notes, and snippets.

@RepComm
Created February 1, 2024 05:07
Show Gist options
  • Save RepComm/600ac5c1a83564dd112a2d0116d12c79 to your computer and use it in GitHub Desktop.
Save RepComm/600ac5c1a83564dd112a2d0116d12c79 to your computer and use it in GitHub Desktop.
Godot absolute force to rigidbody relative force
var upThrust = 1;
var forwardThrust = 2;
var absoluteForce = new Vector3 ( 0, upThrust, forwardThrust );
var relativeForce = absoluteForce * Basis.Transposed(); //The magic BS that makes it work
ApplyCentralForce( relativeForce );
//I fought with ChatGPT, Bard, and google search for quite some time to get this answer.
//You're welcome.
// btw 3x3 matrices are trash, and 4x4 matrices are where its at. guess what godot uses for "Basis"....
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment