4 contact point limit on box-plane collisions can cause oscillation

35 views
Skip to first unread message

Dean Brettle

unread,
Oct 18, 2024, 5:53:33 PM10/18/24
to ode-users
I observe permanent oscillation when dropping a fairly flat box (2 x 2 x 0.1) onto a plane at a slight (e.g 30 deg) angle. This appears to be caused by the box-plane collision code refusing to generating more than 4 contact points (here). Specifically, once the box is entirely below the plane, only the 4 vertices at the lower end of the box are considered contact points. When the contact joint forces push that end of the box up, it creates a torque which rotates the box so that at the next time step the other end is now the lowest end and only its 4 vertices are contact points. The resulting contact joint forces rotate the box in the other direction and then the process repeats forever. If I change the code to allow contact points to be generated for *all* of the vertices that are below the plane, the problem goes away.

Is there a reason for the current limit of 4 contact points? Although it is certainly somewhat faster than evaluating all of the vertices, the existing short circuit means that the relevant code will not be run at all unless there is at least contact point. 

Also, the 4 contact points that are currently returned aren't even guaranteed to be the 4 deepest points. They are computed such that they are all on the same face (here), but, for example, in the case of a cube oriented such that it's diagonal is parallel to the plane's normal, the 4 lowest vertices are not on the same face.

If the current behavior is indeed undesirable, let me know if you'd like a PR which evaluates all of the vertices.

--Dean

Oleh Derevenko

unread,
Oct 18, 2024, 5:58:01 PM10/18/24
to ode-...@googlegroups.com
ODE collisions are supposed to work only for small penetrations. If your box is getting entirely "behind the wall" you need a smaller time step.


Oleh Derevenko

-- Skype with underscore

 



From: ode-...@googlegroups.com <ode-...@googlegroups.com> on behalf of Dean Brettle <dean.b...@gmail.com>
Sent: Saturday, October 19, 2024 0:53
To: ode-users <ode-...@googlegroups.com>
Subject: [ode-users] 4 contact point limit on box-plane collisions can cause oscillation
 
You don't often get email from dean.b...@gmail.com. Learn why this is important


This e-mail may contain privileged and confidential information. If you are not the intended recipient, be aware that any use, disclosure, copying or distribution of this e-mail or any attachments is prohibited. If you have received this e-mail in error, please notify us immediately by returning it to the sender and delete this copy from your system. Thank you.

Oleh Derevenko

unread,
Oct 18, 2024, 6:02:18 PM10/18/24
to ode-...@googlegroups.com
In the old days people used to repeat here: "ODE is designed for speed in games — not for physical perfection".
This is the answer to your question.

Oleh Derevenko

-- Skype with underscore

 



From: ode-...@googlegroups.com <ode-...@googlegroups.com> on behalf of Dean Brettle <dean.b...@gmail.com>
Sent: Saturday, October 19, 2024 0:53
To: ode-users <ode-...@googlegroups.com>
Subject: [ode-users] 4 contact point limit on box-plane collisions can cause oscillation
 
You don't often get email from dean.b...@gmail.com. Learn why this is important
--
You received this message because you are subscribed to the Google Groups "ode-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ode-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ode-users/9c82b778-06f9-410c-97ad-65e7c826a643n%40googlegroups.com.

Dean Brettle

unread,
Oct 27, 2024, 2:35:26 PM10/27/24
to ode-users
Fyi, I've created a pull request that improves the speed, accuracy, and readability of the box-plane collision code. That PR currently lives in my own unaltered fork because I don't have permission to create a PR in the official repo. If you grant me that permission, I'd be happy to make a PR there.

Regarding your earlier response that "ODE is designed for speed in games — not for physical perfection", hopefully this PR will help on both fronts. Comments welcome!

--Dean

Oleh Derevenko

unread,
Oct 27, 2024, 7:36:35 PM10/27/24
to ode-...@googlegroups.com
It seems to me that any user registered at BitBucket can create pull requests there. There is no special permission for that.


Oleh Derevenko

-- Skype with underscore

 


Sent: Sunday, October 27, 2024 20:35
To: ode-users <ode-...@googlegroups.com>
Subject: Re: [ode-users] 4 contact point limit on box-plane collisions can cause oscillation
 

Oleh Derevenko

unread,
Oct 27, 2024, 7:42:46 PM10/27/24
to ode-...@googlegroups.com
That is, there is a permission but pull requests for 'master' are allowed for everyone.

Oleh Derevenko

-- Skype with underscore

 



From: 'Oleh Derevenko' via ode-users <ode-...@googlegroups.com>
Sent: Monday, October 28, 2024 1:36
To: ode-...@googlegroups.com <ode-...@googlegroups.com>

Dean Brettle

unread,
Oct 27, 2024, 7:43:15 PM10/27/24
to ode-users
That's what I would have thought, but I'm a registered user (even have my own fork) and I'm seeing this when I hover over the grayed out "Create pull request" button:

Screenshot from 2024-10-27 16-41-03.png

Dean Brettle

unread,
Oct 27, 2024, 7:55:34 PM10/27/24
to ode-users
My bad. There is a PR on the official ode repo now. I needed to create the PR from the page for my forked repo instead of the page for the official repo. I was further confused because when I tried to target the official repo with a the PR from the VSCode bitbucket extension, it kept making the PR target my own repo, probably due to some bug in the extension. Anyway, the PR is now where it belongs and ready for your review.
--Dean

Oleh Derevenko

unread,
Jan 5, 2025, 3:59:13 PMJan 5
to ode-...@googlegroups.com
Hi Dean,

I've merged your collider function into the master branch.
Alas, I could not merge your changes to demo_ode as they include internal ODE header and depend in functions which are not available outside of the library to external applications (demo_ode is an external application).

Oleh Derevenko

-- Skype with underscore

 



Sent: Monday, October 28, 2024 1:55
Reply all
Reply to author
Forward
0 new messages