Or, if "Cube" is just a composition of Object3Ds and can't be returned directly (or, like in the car example, it is an Object3D itself but contains others), maybe this helps: Write an interface CubePart like so:
public interface CubePart {
Cube getMaster();
}
Make all your parts of Cube (and maybe Cube itself) implement it and return the instance of Cube in all of them (has to be stored in the sub object, which is not very nice, but works...). Then you can do:
Cube cube=((SubObject3D) theWorld.getObject(Interact2D.getObjectID(res))).getMaster();
I suggest not to code against Cube, but against an Interface "Entity" or similar, so that this method can handle more than just instances of Cubes, but to keep the example simple, i restricted it to Cube here.