Add apply impulse to Defold Physics 2D/3D API #8256
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)
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):
The text was updated successfully, but these errors were encountered: