Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose local center of mass in physics servers #54134

Merged

Conversation

pouleyKetchoupp
Copy link
Contributor

@pouleyKetchoupp pouleyKetchoupp commented Oct 22, 2021

Center of mass in body's local space is more useful than the transformed one in some cases, like drawing its position for debug.

It's especially useful to get the generated local center of mass when in auto mode (by default).

Physics Server BODY_PARAM_CENTER_OF_MASS:
Now always returns the local center of mass, instead of setting a local center of mass and getting a transformed one.
This causes compatibility breaking, but it makes more sense for the parameter to be consistent between getter and setter.

Direct Body State:
There are now two properties, because both of them can be useful in different situations.
center_of_mass: relative position in global coordinates (same as before)
center_of_mass_local: position in local coordinates

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs rebase, otherwise seems fine.

Center of mass in body's local space is more useful than the transformed
one in some cases, like drawing its position for debug.

It's especially useful to get the generated local center of mass when
in auto mode (by default).

Physics Server BODY_PARAM_CENTER_OF_MASS:
Now always returns the local center of mass, instead of setting a local
center of mass and getting a transformed one.
This causes compatibility breaking, but it makes more sense for the
parameter to be consistent between getter and setter.

Direct Body State:
There are now two properties, because both of them can be useful in
different situations.
center_of_mass: relative position in global coordinates (same as before)
center_of_mass_local: position in local coordinates
@pouleyKetchoupp pouleyKetchoupp force-pushed the body-center-of-mass-local branch from f7401ef to fc8c766 Compare November 8, 2021 23:18
@pouleyKetchoupp pouleyKetchoupp merged commit c6062cd into godotengine:master Nov 9, 2021
@pouleyKetchoupp pouleyKetchoupp deleted the body-center-of-mass-local branch November 9, 2021 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants