public void init(int id) { // This instance of LocalObject is used in the view only. The crates // aren't real // LocalObject/ClientObject-entities as they are not transfered to the // server. // However, events and collision listeners need some information from // the LocalObject lob = new LocalObject(-99); lob.setObjectID(id); }
public void hitByExplosion( CollisionParticipant source, LocalObject obj, DecalManager decal, CollisionEvent ce) { if (!isInactive()) { Event event = new Event(Event.CRATE_HIT, -99, obj.getObjectID(), -99); int[] ids = ce.getPolygonIDs(); if (ids != null) { // The Crates on the bot client don't return those IDs...and // they don't have to. PolygonManager pm = getPolygonManager(); SimpleVector normal = pm.getTransformedNormal(ids[0]); event.setOrigin(normal); } source.getEventQueue().add(event); } }