www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: bajabob on December 17, 2010, 08:52:55 AM

Title: Need a little direction on Collusion Detection
Post by: bajabob on December 17, 2010, 08:52:55 AM
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
Title: Re: Need a little direction on Collusion Detection
Post by: EgonOlsen on December 17, 2010, 09:06:13 AM
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)
Title: Re: Need a little direction on Collusion Detection
Post by: AGP on August 12, 2016, 09:58:46 AM
I'm almost certain that collisions break whenever setName() is called. Could you verify this, Egon?
Title: Re: Need a little direction on Collusion Detection
Post by: EgonOlsen on August 12, 2016, 05:43:48 PM
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.
Title: Re: Need a little direction on Collusion Detection
Post by: AGP on August 12, 2016, 06:11:51 PM
Then I will replicate it and show it to you.
Title: Re: Need a little direction on Collusion Detection
Post by: EgonOlsen on August 13, 2016, 10:05:17 AM
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.
Title: Re: Need a little direction on Collusion Detection
Post by: AGP on August 18, 2016, 03:50:48 AM
And yet I've run into collision problems when I renamed my bullets in the past.
Title: Re: Need a little direction on Collusion Detection
Post by: EgonOlsen on August 18, 2016, 07:37:47 AM
That's impossible, it has to be a conincidence. The name is used...


That's it! There's no relation to collision whatsoever. It would be plain stupid if there were anyway.