/** Makes a copy of the vector without using the complex clone interface. * * @return copy of the vector */ public IVector3 copy() { return new Vector3Int(this); }
/** * Set the area size. * @param areasize The area size. */ public void setAreaSize(IVector3 areasize) { synchronized(monitor) { this.areasize = areasize==null? null: new Vector3Int(areasize.getXAsInteger(), areasize.getYAsInteger(), areasize.getZAsInteger()); } }
IVector3 fieldpos = new Vector3Int(position.getXAsInteger(), position.getYAsInteger(), position.getZAsInteger());
public Vector3Int getSelectedVector3Int(Node collidenode) { Vector3Int ret = null; CollisionResults results = fireRaytrace(collidenode); if(results.size() > 0) { Vector3f contact = results.getClosestCollision().getContactPoint(); Vector3f worldcontact = contact.divideLocal(this.app.getAppScaled()); Vector3Int intworld = new Vector3Int(Math.round(worldcontact.getX()), Math.round(worldcontact.getY()), Math.round(worldcontact.getZ())); ret = intworld; } return ret; }
public Vector3Int getSelectedVector3Int(Node collidenode) { Vector3Int ret = null; CollisionResults results = fireRaytrace(collidenode); if (results.size() > 0) { Vector3f contact = results.getClosestCollision().getContactPoint(); Vector3f worldcontact = contact.divideLocal(this.app.getAppScaled()); Vector3Int intworld = new Vector3Int(Math.round(worldcontact.getX()), Math.round(worldcontact.getY()), Math.round(worldcontact.getZ())); ret = intworld; } return ret; }
for(int i=0; i<n && ret==null; i++) ret = new Vector3Int(getRandomPosition(Vector3Int.ZERO)); if(objectsygridpos.containsKey(ret)) ret = null; ret = new Vector3Int(x, y, z); if(objectsygridpos.containsKey(ret)) ret = null;
/** * Creates a new {@link ContinuousSpace2D} with a special ID. * @param name the name of this space * @param areasize the size of the 2D area * @param actionexecutor executor for component actions */ public Grid3D(Object name, IVector3 areasize) { super(areasize==null? null: new Vector3Int(areasize.getXAsInteger(), areasize.getYAsInteger(), areasize.getZAsInteger())); this.setProperty("name", name); this.objectsygridpos = new MultiCollection(); }
/** * Destroys an object in this space. * @param objectId the object's ID */ public void destroySpaceObject(Object id) { try { synchronized(monitor) { // remove the object from grid IVector3 pos = (IVector3)getSpaceObject(id).getProperty(Space3D.PROPERTY_POSITION); if(pos!=null) { IVector3 fieldpos = new Vector3Int(pos.getXAsInteger(), pos.getYAsInteger(), pos.getZAsInteger()); objectsygridpos.removeObject(fieldpos, spaceobjects.get(id)); } super.destroySpaceObject(id); } } catch(Exception e) { e.printStackTrace(); } }
int y = position.getYAsInteger(); int z = position.getYAsInteger(); IVector3 pos = new Vector3Int(x, y, z); Vector3Int testpos = new Vector3Int((i + sizex) % sizex, (j + sizey) % sizey, (k + sizez) % sizez); if(!getDistance(testpos, pos).greater(distance))
if(oldpos!=null) oldpos = new Vector3Int(oldpos.getXAsInteger(), oldpos.getYAsInteger(), oldpos.getZAsInteger()); if(objectsygridpos.containsKey(oldpos)) if(newpos!=null) objectsygridpos.add(new Vector3Int(newpos.getXAsInteger(), newpos.getYAsInteger(), newpos.getZAsInteger()), obj);