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 apply impulse to Defold Physics 2D/3D API #8256

Closed
rthery opened this issue Nov 23, 2023 · 0 comments · Fixed by #8712
Closed

Add apply impulse to Defold Physics 2D/3D API #8256

rthery opened this issue Nov 23, 2023 · 0 comments · Fixed by #8712
Labels
engine Issues related to the Defold engine feature request A suggestion for a new feature physics Issues related to physics (2D and/or 3D)

Comments

@rthery
Copy link

rthery commented Nov 23, 2023

Is your feature request related to a problem? Please describe (REQUIRED):
I’m trying to port a Unity game to Defold, it relies heavily on the 2D physics engine, which fortunately is Box2D in both.

In our Unity games, we use a lot ForceMode2D.Impulse, which I guess translates internally to ApplyLinearImpulse

But in Defold, I only see apply_force

Describe the solution you'd like (REQUIRED):
Same way as we currently have apply_force, I'd like to have apply_impulse
Internally, for 2D it would call ApplyLinearImpulse
for 3D, Bullet has applyImpulse, but I can't find it in the code source of Defold (not sure if maybe it's because the actual source are not in the repo, but downloaded later when building ?)
Or like Unity did, add a parameter to the apply_force to specify if it's a force or an impulse.

I'd be happy to contribute a potential solution if we can agree on something.

Describe alternatives you've considered (REQUIRED):
I believe I could maybe set linear_velocity taking into account the mass of my rigidbody, but I’d rather let the physics engine set the final velocity of the rigidbodies.

Alternatively, I could just bring Box2D directly via https://defold.com/assets/defold-box2d/, but it seems it would require much more code and time to then use physics in the game, which relies heavily on physics to begin with...

Additional context (OPTIONAL):

@rthery rthery added the feature request A suggestion for a new feature label Nov 23, 2023
@britzl britzl added physics Issues related to physics (2D and/or 3D) engine Issues related to the Defold engine labels Nov 23, 2023
@JCash JCash mentioned this issue Mar 25, 2024
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engine Issues related to the Defold engine feature request A suggestion for a new feature physics Issues related to physics (2D and/or 3D)
Projects
No open projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants