jaipack17 / Nature2D

A 2D physics engine for Roblox. Create versatile physics simulations and mechanics with GUIs!
https://jaipack17.github.io/Nature2D/
MIT License
147 stars 8 forks source link

keep velocity after collision #46

Open Toastaspiring opened 1 year ago

Toastaspiring commented 1 year ago

Dear jaipack17 or Git User,

Of the many methods you scripted, the one I like the most is RigidBody:ApplyForce(). However, I've been stumbling upon a problem recently. While trying to calculate the new velocity after collision seems nice in theory it seems the force is reset due to the CollisionResponse defined in the Runner file.

Is there a way to Add up the Forces? or a calculation which would work in my case?

PS: I experimented with a ball colliding and accelerating in an empty box

jaipack17 commented 1 year ago

You can increase the force vector you are passing into RigidBody:ApplyForce(force, time) every certain amount of time to achieve that maybe, If that fulfils your requirement? You can also specify a time (in seconds) if you want the same force to act for a period of time.