Bowl of Eggs Physics Demo

Back to this again.
Do you notice that the smallest sphere sometimes get stuck on the bowl ?
It’s because the small sphere and the middle sphere try to go to opposite direction. I replaced the small one with a capsule to avoid that silly situation.
Now I use tight bounds to get the size of the collision objects.

download : bowl-egg.zip

Excellent, it looks and works much more stable now.

However, when I add your tight bounds joints to the rest of the ODE meshes (basically implement your method for the detecting the collisions) It causes the pedestal to go crazy, while before the pedestal could calmly intersect into the table and continue to move using the plane2DJoint. Take a look for example:

download.yousendit.com/5FFC1C193154A997

here’s the one that “works”

download.yousendit.com/ECC464B935909AE5

Don’t blame me, it’s plane2d’s fault. Don’t use plane2d to see the difference.

LOL, I dont blame you, but thats weird though.
I used plane2D to set the height of the bowl to still be affected by forces…so i’ll experiment a bit to see what I can do to keep it since I cant adjust the Z on anything.
Also what are “tight bounds” I was looking in the PyODE API but I couldnt find anything on them. From studying your stuff it looks like tight bounds replace the setScale for sizing the collision objects to the real meshes.

Is there any reason why tight bounds would be any better to use than the first way you used to get the size of the collision objects? Also is it the fact you used the new capsule ODE object or the tight bounds collision sizing that prevents the egg getting stuck in the bowl.

Thanks

getTightBounds is a method in Panda, find it in pandac\libpandaModules.py.
No, tight bounds is not replacing setScale. We don’t need to rescale each object everytime after simulation step, since we’re not updating the position & rotation using matrix anymore. As I wrote earlier, we can use quaternion to set the rotation, without touching the scale.

First way ? Which one ? Object’s scale ?
Of course it’s better. getTightBounds returns the tight bounds of a geometry under the given node, by iterating through the vertices to find the outermost vertices. It respects the node’s transformation, and the result is in render coordinate space. For example, say you have a cube of 1,1,1 in size. If you change it’s heading to 45, you would get (1.41421, 1.41421, 1) bounds, the AABB.
en.wikipedia.org/wiki/AABB
That’s why I cleared object’s rotation (which then restored) before grabbing the tight bounds, to get the OBB, oriented to object’s coordinate space.

Using tight bounds has nothing to do with the sim’s performance.
Stuck-proof is done by using the capsule, since it covers the egg’s long axis entirely, from top to bottom. In the earlier version, sometimes the egg get stuck when the bowl (both innner and outer surface) is trapped in the middle of smallest sphere’s center and the middle sphere’s center. They try to get off the bowl, but to opposite direction, so instead of getting off the bowl, the egg keep dancing there.

Sorry, I was wrong.
getTightBounds result is NOT in render coord space, but in object’s parent CS.
update : bowl-egg.zip

Thanks ynjh_jo, Once again excellent explainations.

When I mentioned “first way” I should have said “in the earlier version” but you answered my question precisely.

Thanks for the heads up of what and where getTightBounds info was located…it really loos like a ODE or PyODE method

Thanks again for the information, I also keep you posted if I find anything on the Plane2D issue

In playing around with the files (to try to get Plane2D working in some fashion) I noticed that we can get the size of the collision object in 2 ways (correct me if I am wrong please):

A Transform Matrix to set the position and Rotation or
or use tightBounds to get the OBB of the collision Obj

If this is the case then is it possible to mix the two methods to set the collision object or do you need to stay with one or the other throughout the simulation.

In the case of Plane2D, here is my main issue:
In the ODE how-to section opende.sourceforge.net/wiki/inde … ects_to_2d they list:

   dJointID planeJointID = dJointCreatePlane2D( odeWorldID, 0);
   dJointAttach( planeJointID, odeBodyID, 0 );

I am able to convert this to pyODE to set my Plane2D joint but it doesnt let me set a fixed Z…I am assuming if I change the “0” to 3 it would make my Z axis at 3? :question:
Thanks again

P.S. On my version with the Pedestal I am using the matrix transformation method for the collision obj. The egg seems to jitter around (due to the opposing directions I assume). How would I implement a capsule ODEObject using the Matrix transform method. Thanks!

So you haven’t digest that well. They play different role in the sim.

  1. the very early code uses transform matrix to sync the real mesh to it’s body. It’s done everytime after sim timestep.
  2. tightbounds is used to create ode.geomXXXX according to the acurate size of the collision mesh. It’s done only at ode.geomXXXX creation time.

About plane2d, I’m not sure how to get it work. Have you found any working ODE sample using plane2d ? I looked at test_plane2d.cpp in ODE 0.7 source. It’s setup exactly the same.

I even tried using 2 slider joints, but that’s just silly.

        # create slider joints of Y axis #################
        sJ1=ode.SliderJoint(self.ode_WORLD)
        sJ1.attach(self.hangingBody, ode.environment)
        sJ1.setAxis((0,1,0))
        # make sure to "save" the joint
        self.simJoints.append(sJ1)

        # create slider joints of X axis #################
        self.SIM_pedestal.body.setPosition(self.hangingBody.getPosition())
        sJ2=ode.SliderJoint(self.ode_WORLD)
        sJ2.attach(self.SIM_bowl.body, self.hangingBody)
        sJ2.setAxis((1,0,0))
        # make sure to "save" the joint
        self.simJoints.append(sJ2)

I guess you can just stick to your pedestal approach.

Thanks ynjh_jo,
I really do appreciate your help.
It was a little hard to digest that info but I think I understand it now. I havent found any working samples of the plane2D but if I do or manage to get it working I’ll post it. Thanks again