Skip to content

Enable/disable: gravity and static (Bullet and Bullet-featherstone)#887

Open
ahcorde wants to merge 3 commits intoahcorde/7/gravity_staticfrom
ahcorde/7/gravity_static_bullet
Open

Enable/disable: gravity and static (Bullet and Bullet-featherstone)#887
ahcorde wants to merge 3 commits intoahcorde/7/gravity_staticfrom
ahcorde/7/gravity_static_bullet

Conversation

@ahcorde
Copy link
Contributor

@ahcorde ahcorde commented Mar 5, 2026

🎉 New feature

Summary

Test it

Checklist

  • Signed all commits for DCO
  • Added a screen capture or video to the PR description that demonstrates the feature
  • Added tests
  • Added example and/or tutorial
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • Updated Bazel files (if adding new files). Created an issue otherwise.
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers
  • Was GenAI used to generate this PR? If so, make sure to add "Generated-by" to your commits. (See this policy for more info.)

Generated-by: Some tips by Cloude Opus 4.6

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by and Generated-by messages.

ahcorde added 2 commits March 4, 2026 15:24
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
…_bullet

Signed-off-by: Alejandro Hernández Cordero <ahcorde@gmail.com>
}
if (_enabled)
{
worldInfo->world->setGravity(worldInfo->gravity);
Copy link
Contributor

Choose a reason for hiding this comment

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

Just checking...Why do you need to modify the gravity of the entire world?


namespace
{
std::unordered_map<std::size_t, bool> gravityStates;
Copy link
Contributor

@caguero caguero Mar 6, 2026

Choose a reason for hiding this comment

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

Should we move this global variable to a place where the scope is model?

body->setGravity(gravity);
if (!_enabled)
{
// Zero out velocities and forces so the body doesn't drift
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this behavior consistent in the other physic engines? I'm not sure if the right call here would be to not zero velocities.

rootMultiBody->setUserIndex(std::size_t(rootID));

auto modelID =
auto modelID =
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Remove extra indent?

auto modelID =
this->GenerateIdentity(rootModelID, this->models[rootModelID]);
const auto *model = this->ReferenceInterface<ModelInfo>(modelID);
auto *model = this->ReferenceInterface<ModelInfo>(modelID);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Remove extra indent?

if (nestedModelIt == this->models.end())
continue;
auto nestedIdentity = this->GenerateIdentity(
nestedModelID, nestedModelIt->second);
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: There are some 4-space indentation instead of 2-space. Take a look at them for consistency.

if (!proxy)
return;

if (_linkInfo->isStaticOrFixed)
Copy link
Contributor

Choose a reason for hiding this comment

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

A tiny optimization but should we move this check before populating proxy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

3 participants