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

set_lin_acc is useless outside of nphysics. #10

Closed
sebcrozet opened this issue Jul 7, 2014 · 5 comments
Closed

set_lin_acc is useless outside of nphysics. #10

sebcrozet opened this issue Jul 7, 2014 · 5 comments

Comments

@sebcrozet
Copy link
Member

The acceleration of each object is reset to the world's gravity at the beginning of each update. This mean that any call to set_lin_acc (or set_ang_acc) is just a no-op from the user point of view.

Here are some possible fixes:

  1. Let the user define his own force generator (which would replace the default BodyForceGenerator).
  2. Implement something like box2d's setGravityScale.
  3. Let each rigid body have a user-defined resultant force that would later be added to the gravity.
@tomaka
Copy link

tomaka commented Jul 18, 2014

set_lin_acc_scale has an effect on gravity, but set_lin_acc still doesn't seem to have any effect.

If I call lin_acc I obtain the value that I have previously set, but no matter which value this has the object won't move.

@sebcrozet
Copy link
Member Author

That's right, my previous patch did not intend to make set_lin_acc effectful, but to add set_lin_acc_scale as a workaround. A better solution that would make set_lin_acc really effectful is more complicated.

In the mean time, I reopen this issue because I realize that it is worked around but not fixed.
Do you have a use-case where something like set_lin_acc would do something that set_lin_acc_scale cannot?

@sebcrozet sebcrozet reopened this Jul 18, 2014
@tomaka
Copy link

tomaka commented Jul 19, 2014

The idea is to do set_gravity(1.0, 1.0) and then manage all the accelerations manually using set_lin_acc_scale?
I didn't think of this, but it should work!

@sebcrozet
Copy link
Member Author

Exactly! Though I know that this looks like a hack.

@sebcrozet
Copy link
Member Author

Starting with v0.8.0, nphysics, set_lin_acc no longer exists. Force generators are not the way to go to customize, e.g., gravity (using force_generator::ConstrantAcceleration) in a per-object basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants