I am not new to Java, but am to jPCT! I must say, so far I am really impressed!
I am trying to solve this issue, I cannot register a callback even when my objects supposedly collide. Any input? I'm using the same object twice.
Init:
floor = Loader.load3DS(res.openRawResource(R.raw.object), 1)[0];
walls = Loader.load3DS(res.openRawResource(R.raw.object), 1)[0];
floor.translate(0, 0, -10);
floor.setName("floor");
floor.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
floor.addCollisionListener(this);
walls.translate(0, 0, 0);
walls.setName("walls");
walls.setCollisionMode(Object3D.COLLISION_CHECK_OTHERS);
walls.addCollisionListener(this);
world.addObject(walls);
world.addObject(floor);
walls.strip();
floor.strip();
OnDrawFrame:
SimpleVector s = floor.getCenter();
floor.translate(s.x, s.y, s.z+1);
Override "collision":
Log.d("COLLUSION DETECTED!!!", "!!!!!!");
Can't wait to find out what I did. My first attempt at 3D.
Bob
translate() doesn't recognize any collisions. You have to use one of the checkCollision...methods to actually make jPCT check for collisions. Have a look here: http://www.jpct.net/wiki/index.php/Collision_detection (http://www.jpct.net/wiki/index.php/Collision_detection)
I'm almost certain that collisions break whenever setName() is called. Could you verify this, Egon?
No, it has nothing to do with it. setName() sets a new name, i.e. it assigns a string. The name and the collisions are not related in any way.
Then I will replicate it and show it to you.
Good luck with that. It's a simple String. It's not used for anything else then log output. The two topics are as unrelated as it gets.
And yet I've run into collision problems when I renamed my bullets in the past.
That's impossible, it has to be a conincidence. The name is used...
- ...to print out log messages
- ...in World to access objects via their name. But the API itself doesn't use this, it's solely for the user.
- ...in Serializer/Deserializer to...serialize and deserialize the name.
That's it! There's no relation to collision whatsoever. It would be plain stupid if there were anyway.