New with ODE

Hey I am new with ODE. I am currently setting up a little demo to shoot a ball out of a cannon and have it bounce off a wall and back to the surface floor. I am having some confusion however. I cannot determine how to make walls. After reading through the manual it seems that the only auto collision you can do with ODE involves colliding with the surface floor. I see nothing in the manual showing otherwise. Can anyone give me some examples or tell me how to have objects bounce off other objects through auto-collide?

It’s done just the same way.

You just make an OdeBoxGeom, OdeTriMeshGeom, or any other. You don’t set a Body to it, so it will be a static object. And then you just shoot whatever you want at it, and it will bounce off. AutoCollide (or collisions in general) is about any collisions, not just the floor.

There’s actually no difference between a floor, a ceiling, walls or anything else in ODE.

The manual only shows floor because that’s the simplest example, not because there are any limitations.

The problem with that is, once I set up the second static object gravity is screwed up. I have standard gravity of -9.81. When I set up the ground being like so

    cm = CardMaker("left")
    cm.setFrame(-20, 20, -20, 20)
    ground = render.attachNewNode(cm.generate())
    ground.setPos(-20, 0, 10);   ground.lookAt(-100, 0, 10)
    groundGeomLeft = OdePlaneGeom(, Vec4(-1, 0, 0, 0))


    groundCard = render.attachNewNode(cm.generate())
    groundCard.setPos(0, 0, 0); groundCard.lookAt(0, 0, -100)
    groundGeomBottom = OdePlaneGeom(, Vec4(0, 0, 1, 0))

with this the gravity changes with all objects being pulled both down and to the left because gravity is pulling toward both objects. I cant seem to set these up without the second object not using gravity.

I don’t get something here… You don’t do anything with gravity in this code. By the way, next time use “code” tags, please.

setting gravity in ODE is done with this code:

world = OdeWorld()
world.setGravity(0, 0, -9.81)

And it really doesn’t matter how many, or how oriented, geoms you have in the world. I might be wrong, since I don’t use PlaneGeoms, but I see no reason why they would be any different from others. And I see no reason why they would affect the direction of gravity, which is set completely separately.

In ODE, gravity has nothing to do with collision detection, which the code you’ve shown is related to. ODE has two parts – one is the World and the other is the Space. The World deals with gravity and bodies and it has nothing to do with collision detection, while geoms in Space have nothing to do with gravity.

Please show the whole code you’re working on, because this part is certainly not the source of the problem.

I fixed it. It turned out that planes aren’t stable in ODE. The second you try and move them they crash. I did have gravity in my code I just showed the portion of code that made the planes. Instead of planes i just made a box object that was insanely tall and wide but really thin. I think it was like 1L, 200W, 200H. Once I made those and placed them it worked.