# ODE cylinder to cylinder collision

In this sample it is shown that there is no cylinder to cylinder collision. But if instead of cylinders I put any other object - all worked. Also the cylinder geometry with the non-cylinder is collided normally. Looks like a bug… or I do something wrong?
(I use FenrirWolf’s wireGeom discourse.panda3d.org/viewtopic.php?t=6619 for visualisation)
I checked it on version 1.7.0

``````# -*- coding: utf_8 -*-
from direct.directbase import DirectStart
from direct.showbase import DirectObject
from pandac.PandaModules import *
from random import randint, random
import math, sys
from ODEWireGeom import wireGeom
class World():
def __init__(self):
self.world = OdeWorld()
self.world.setGravity(0, 0, -9.81)
self.world.initSurfaceTable(1)
self.world.setSurfaceEntry(0, 0, 150, 0.0, 9.1, 0.9, 0.00001, 0.0, 0.002)

self.space = OdeSimpleSpace()
self.space.setAutoCollideWorld(self.world)
self.contactgroup = OdeJointGroup()
self.space.setAutoCollideJointGroup(self.contactgroup)

self.boxes = []
for i in range(randint(50, 100)):
sx=random()+0.5
sy=random()+0.5
sz=random()+0.5
#boxNP = wireGeom().generate ('box', extents=(sx, sy, sz))
boxNP = wireGeom().generate ('cylinder', radius=sx, length=sy)
boxNP.reparentTo(render)
boxNP.setPos(randint(-5, 5), randint(-5, 5), 10 + random())
boxNP.setColor(random()*2, random()*2, random()*2, 1)
boxNP.setHpr(randint(-45, 45), randint(-45, 45), randint(-45, 45))

boxBody = OdeBody(self.world)
M = OdeMass()
#M.setBox(15, sx, sy, sz)
M.setCylinder(15, 1, sx, sy)
boxBody.setMass(M)
boxBody.setPosition(boxNP.getPos(render))
boxBody.setQuaternion(boxNP.getQuat(render))
#boxGeom = OdeBoxGeom(self.space, sx,sy,sz)
boxGeom = OdeCylinderGeom(self.space, sx,sy)
boxGeom.setBody(boxBody)
self.boxes.append((boxNP, boxBody))

self.cm = CardMaker("ground")
self.cm.setFrame(-20, 20, -20, 20)
self.ground = render.attachNewNode(self.cm.generate())
self.ground.setPos(0, 0, 0); self.ground.lookAt(0, 0, -2)
self.groundGeom = OdePlaneGeom(self.space, Vec4(0, 0, 1, 0))
base.disableMouse()
base.camera.setPos(40, 40, 20)
base.camera.lookAt(0, 0, 0)
base.accept('space',self.jump)
def jump(self):
for np, body in self.boxes:
body.addForceAtRelPos(randint(-500, 500),randint(-500, 500),randint(5000, 15000),0,0,0)
self.space.autoCollide()
self.world.quickStep(globalClock.getDt())
for np, body in self.boxes:
np.setPos(render, body.getPosition())
np.setQuat(render,Quat(body.getQuaternion()))
self.contactgroup.empty()

base.accept('escape',sys.exit)

World()
base.disableMouse()
camera.setPos(20,20,20)
camera.lookAt(0,0,0)
run()``````

Sorry for my english.

ODE doesn’t support cylinder-cylinder collisions. opende.sourceforge.net/wiki/inde … _Detection

Oops I am sorry, I did not know it