[ODE] Cylinder collisions?

Ron Barry Ron.Barry at Sun.COM
Mon Nov 28 10:02:56 MST 2005


Peter Onion wrote:
> I was looking in the archive and I found his post
> http://q12.org/pipermail/ode/2005-October/016927.html
> which suggests using two geoms (a sphere and a box) to model a disk,
> which is more or less what I want, but I'm a bit unsure as to what has
> to go in the  nearCallback.  I have some ideas so I'll give it a try.

I was the original poster of the question you listed there, but I
don't think the solution I used is much help to anyone:  Because I
only really needed 'coins' to collide edge-on and not float on any
surface, I used spheres instead.  All forces, rotations, and surface
normals are constrained to have zero magnitude in the dimension
perpendicular to the plane in which my work is being done.

Essentially, I'm doing my coin-edge interaction in a 2D universe
using the sphere as my 'circle'.

To solve my other issue of attaching multiple geoms in multiple
spaces to a single body, I finally gave up.  My workaround was
something like this:

class coin {
	dBody dynamicObj;
	dSphere collisionObj;
	dSphere parallelUniverseObj;

	coin () {
		//create bodies, geoms.  parallelUniverseObj is created in
		//a different space than collisionObj
	}

	UpdateF (dReal frac) {
		//do stuff in the 'normal' universe.
		parallelUniverseObj.setPosition(dynamicObj.getPosition());
		//If you want to set the rotation as well, you'd do it here.
		//Working with sphere/circles, this was not relevant for me.
	
		//do collisions and their effects in the parallel universe.
	}
} ;

This has worked well for me.  I can stack coins edge-on as high as
I like and never see them 'fall' into the third dimension.  I use the
parallel dimension to do nearness checking and little else - because
I'm tremendously lazy.  It would work fine, however, to use it for
the equivalent of what I asked in that original question - making a
coin that would slide on a flat surface.

	rOn


More information about the ODE mailing list