Collision Listener not working

Started by fireside, March 15, 2008, 12:28:14 AM

Previous topic - Next topic

fireside

I'm not sure if I'm way off base trying to use the Collison Listener, but I have this class as follows:

public class Mouse extends Base implements CollisionListener {

public Mouse(Object3D obj) {
super(obj);
// TODO Auto-generated constructor stub
}

private Object3D colObj;

@Override
public void collision(CollisionEvent event) {
colObj = event.getObject();
// TODO Auto-generated method stub

}

@Override
public boolean requiresPolygonIDs() {
// TODO Auto-generated method stub
return false;
}
public void update()
{  if(colObj != null)System.out.println(colObj.getID());
colObj = null;
}

}




In the loop, I have mouse.update();

I walk the mouse around, he collides with things, but the println() command never gets called.
click here->Fireside 7 Games<-

EgonOlsen

Maybe you should add a debug output in the collision-method too...just to be sure. Apart from that: Has the listener been added correctly to the object in question?

fireside

#2
Is there an example of a collision listener being used anywhere?  I can't quite understand how it was meant to work.

edit: Oh, the car demo has one.  I'll study that for a while.



click here->Fireside 7 Games<-