Author Topic: About CollisionListener in Android  (Read 1344 times)

Offline spidercpsf

  • byte
  • *
  • Posts: 1
    • View Profile
About CollisionListener in Android
« on: August 22, 2011, 08:18:50 am »
Hello everybody.
Now I am programming game by jpct-ae.
I want check collision (source and target) but I can't.
my code is:

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

Code: [Select]
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!

Offline Nemetz

  • int
  • **
  • Posts: 53
    • View Profile
Re: About CollisionListener in Android
« Reply #1 on: August 22, 2011, 09:40:19 am »
did you set object.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS); ?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11744
    • View Profile
    • http://www.jpct.net
Re: About CollisionListener in Android
« Reply #2 on: August 22, 2011, 10:01:36 am »
And how are you moving the objects? You have to use the checkCollision...methods...a simple translate can't detect a collision.