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

Add ExternalImpulse and ExternalAngularImpulse #95

Merged
merged 3 commits into from
Jul 22, 2023
Merged

Conversation

Jondolf
Copy link
Owner

@Jondolf Jondolf commented Jul 22, 2023

Adds the ExternalImpulse and ExternalAngularImpulse components. They are like external forces and torque, but they are instant instead of being applied over time, and they are cleared every physics frame by default.

I tested the behaviour against Unity's impulses, and it looks correct with a similar configuration where an impulse is applied upwards at the right side of the cube, which also applies an angular impulse.

Impulse.comparison.mp4

Naming

I considered naming the positional impulse ExternalLinearImpulse for consistency (e.g. LinearVelocity and AngularVelocity), but "linear impulse" might not be a very common term so I named it just ExternalImpulse for now.

Some engines also call the angular impulse a "torque impulse", but physically it's called an angular impulse afaik, so I named it that.

I'm also wondering if we should maybe remove or replace the "External" from the component names at some point, since Force and Impulse look much nicer in my opinion, and I haven't seen many engines other than Rapier use the word external before. It does make it a bit clearer that it doesn't include e.g. contact forces, but I still kinda like the ergonomics of just Force, and we could technically even add a total_force property that actually does contain gravity and constraint forces as well. That's something to consider in a future PR though.

@Jondolf Jondolf added the C-Enhancement New feature or request label Jul 22, 2023
@Jondolf Jondolf merged commit 4718ff0 into main Jul 22, 2023
@Jondolf Jondolf deleted the external-impulses branch July 22, 2023 21:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant