Oimo linear damping

setting linear damping using Oimo has no effect.


Hi J

According to Oimo.js/RigidBody.js at gh-pages · lo-th/Oimo.js · GitHub … there is no such property as .linearDamping… on an Oimo rigidBody (physicsBody) object.

Oimo is a racing engine… not many luxury features. :slight_smile:

Are you trying to keep the spheres from rolling-on forever?

Although a bit performance-hoggy, and probably NOT GOOD for > 1000 spheres… there IS a way to fake some sphere-roll friction/damping. It got named @RaananW’s Leather Boot… because Raanan was the first person around here… to suggest it, and it is very much like pushing a leather work boot against the spheres… to make them slow to a stop. :slight_smile:

Now that all that fanfare is finished… https://www.babylonjs-playground.com/#OJVVA#24

I put all 20 spheres into allSpheres array, and then… see lines 32-37. Line 35 is an angularVelocity down-scaler… removing 15% of all spheres’ angular velocity… every frame (every physics world step, actually?). It will stop a sphere from rolling-down ANY steep mountainside, not a problem. :slight_smile:

It runs constantly, even when no forces/spheres are physics-active. Do we care? Nah. :slight_smile:

We COULD try something like… if (angularVelocity != Vector3.Zero()) then apply the brakes on THIS sphere some more. Else… it is already stopped. Not sure if that will improve perf alot… or hurt it. Maybe… if (!physicsBody.isSleeping) or similar, too… various ways to TRY to test for “already stopped so no more braking needed”.

I tried to use linear velocity/damping in line 34, but it killed the spheres’ gravity-drop speeds. ie. it sucked. :slight_smile:

Ok, I hope I have been helpful. Others may have (better) ideas, so stay tuned. :slight_smile:


Wingnut to the rescue :smiley:

I wasn’t aware of any feature difference between physics engines.
Oimo is fast, that’s why i want to use it.

Thank you for the help!

1 Like