About CollisionListener in Android

Started by spidercpsf, August 22, 2011, 08:18:50 AM

Previous topic - Next topic

spidercpsf

Hello everybody.
Now I am programming game by jpct-ae.
I want check collision (source and target) but I can't.
my code is:

SimpleVector dir=Interact2D.reproject2D3DWS(cam, fb, (int)xpos, (int)ypos-44);
Object[] res=world.calcMinDistanceAndObject3D(cam.getPosition(), dir, 10000 /*or whatever*/);


thing[3].addCollisionListener(new CollisionListener() {

@Override
public boolean requiresPolygonIDs() {
// TODO Auto-generated method stub
return false;
}

@Override
public void collision(CollisionEvent ce) {
// TODO Auto-generated method stub
Log.d("PickCollision", "colision");
}
});


when I touch to object, it worked. But when I move object to collision, it don't work.
thank you!

Nemetz

did you set object.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS); ?

EgonOlsen

And how are you moving the objects? You have to use the checkCollision...methods...a simple translate can't detect a collision.