i am having a problem with collision. I have a square that the user drags through an avatar. When they collide there is no event and showCollisions has no effect.
this is the code to attach the collision box:
collisionPoly = CollisionPolygon(Point3(x,y,z),
Point3(dx, y,z),
Point3(dx,dy,z),
Point3(x,dy,z))
self.dragBoxCollider = self.dragBoxPath.attachNewNode(CollisionNode('dragbox'))
self.dragBoxCollider.node().addSolid(collisionPoly)
self.dragBoxCollider.show()
self.dragBoxPath.setColor(0,.5,0,.75)
self.dragBoxPath.setRenderMode(RenderModeAttrib.MWireframe, 2)
code for adding the collision sphere to the avatar:
#load thest models
model=loader.loadModel('manta/manta')
#put them in the world
model.reparentTo(render)
model.setPos( 100, 150, 100)
# model.setHpr(140,0,0)
model.setScale(20)
cs = CollisionSphere(0, 0, 0, 20)
cnodePath = model.attachNewNode(CollisionNode('cnode'))
cnodePath.node().addSolid(cs)
cnodePath.show()
also on a side note with verbose on, when i click in the window and hold the application will crash with:
Assertion failed: imax >= 0 at line 335 of panda/src/linmath/lmatrix4_src.cxx
Traceback (most recent call last):
File "/opt/eclipse/plugins/org.python.pydev.debug_1.0.6/pysrc/pydevd.py", line 729, in ?
debugger.run(setup['file'], None, None)
File "/opt/eclipse/plugins/org.python.pydev.debug_1.0.6/pysrc/pydevd.py", line 614, in run
execfile(file, globals, locals) #execute the script
File "/home/kelly/workspace/panda/src/MapNode.py", line 153, in ?
run( )
File "debtmp/usr/share/panda3d/direct/src/showbase/ShowBase.py", line 1956, in run
File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 821, in run
File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 769, in step
File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 703, in __stepThroughList
File "debtmp/usr/share/panda3d/direct/src/task/Task.py", line 633, in __executeTask
File "debtmp/usr/share/panda3d/direct/src/showbase/ShowBase.py", line 1286, in igLoop
AssertionError: imax >= 0 at line 335 of panda/src/linmath/lmatrix4_src.cxx
thanks