From: witmud <wi...@ya...> - 2007-08-19 08:27:01
|
i setup a ray test for selecting body : #------A Ray code : start = (-1,1,2) end = (-1,1,-2) ray = ode.GeomRay(space, 10) ray.set(start,end) #------Ray collision detecting code: for i in range(space.getNumGeoms()): geom1 = ray geom2 = space.getGeom(i) contacts = ode.collide(geom1, geom2) if contacts and geom2.placeable(): #print contacts gpos = geom2.getBody().getPosition() print "Gpos=", gpos cpos, normal, depth, geom1, geom2 = contacts[0].getContactGeomParams() print "Cpos=",cpos, normal break but the displayed contact position is wired, this is the output on console: #-------Cpos is contact position Cpos= (-1.7109856605529785, 1.7109856605529785, 0.57802879810333252) Cpos= (-1.7049093246459961, 1.7049093246459961, 0.59018146991729736) Cpos= (-1.6461362838745117, 1.6461362838745117, 0.70772731304168701) you know the ray is fixed from start = (-1,1,2) to end = (-1,1,-2), y =1, so all of Cpos.y should be 1.0 but all Cpos.y are more than 1! ____________________________________________________________________________________ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz |