com.jme3.scene.Spatial Java Examples
The following examples show how to use
com.jme3.scene.Spatial.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DragAndDropControl.java From Lemur with BSD 3-Clause "New" or "Revised" License | 6 votes |
protected void dragStopped( CursorButtonEvent event, CursorMotionEvent lastMotion, Spatial target, Spatial capture ) { if( !draggingActive ) { return; } if( log.isTraceEnabled() ) { log.trace("dragStopped(" + event + ", " + target + ", " + capture + ")"); } draggingActive = false; DefaultDragSession session = clearSession(event); if( session == null ) { // There was no active session... but then why did we get a stopped? log.warn("dragStopped() called with no active session, event:" + event + ", target:" + target + ", capture:" + capture); return; } session.close(new DragEvent(session, lastMotion, session.getDropCollision())); }
Example #2
Source File: ShadowUtil.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Helper function used to recursively populate the outputGeometryList * with geometry children of scene node * * @param camera * @param scene * @param outputGeometryList */ private static void addGeometriesInCamFrustumFromNode(Camera camera, Node scene, RenderQueue.ShadowMode mode, GeometryList outputGeometryList) { if (scene.getCullHint() == Spatial.CullHint.Always) return; camera.setPlaneState(0); if (camera.contains(scene.getWorldBound()) != Camera.FrustumIntersect.Outside) { for (Spatial child: scene.getChildren()) { if (child instanceof Node) addGeometriesInCamFrustumFromNode(camera, (Node)child, mode, outputGeometryList); else if (child instanceof Geometry && child.getCullHint() != Spatial.CullHint.Always) { camera.setPlaneState(0); if (checkShadowMode(child.getShadowMode(), mode) && !((Geometry)child).isGrouped() && camera.contains(child.getWorldBound()) != Camera.FrustumIntersect.Outside) { outputGeometryList.add((Geometry)child); } } } } }
Example #3
Source File: SilentTangentBinormalGenerator.java From OpenRTS with MIT License | 6 votes |
public static void generate(Spatial scene, boolean splitMirrored) { if (scene instanceof Node) { Node node = (Node) scene; for (Spatial child : node.getChildren()) { generate(child, splitMirrored); } } else { Geometry geom = (Geometry) scene; Mesh mesh = geom.getMesh(); // Check to ensure mesh has texcoords and normals before generating if (mesh.getBuffer(Type.TexCoord) != null && mesh.getBuffer(Type.Normal) != null) { generate(geom.getMesh(), true, splitMirrored); } } }
Example #4
Source File: VRAppState.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Get the observer final position within the scene. * @return the observer position. * @see #getFinalObserverRotation() */ public Vector3f getFinalObserverPosition() { if( environment.getVRViewManager() == null ) { if( environment.getObserver() == null ) { return environment.getCamera().getLocation(); } else{ return ((Spatial)environment.getObserver()).getWorldTranslation(); } } Vector3f pos = environment.getVRHardware().getPosition(); if( environment.getObserver() == null ) { environment.getDummyCamera().getRotation().mult(pos, pos); return pos.addLocal(environment.getDummyCamera().getLocation()); } else { ((Spatial)environment.getObserver()).getWorldRotation().mult(pos, pos); return pos.addLocal(((Spatial)environment.getObserver()).getWorldTranslation()); } }
Example #5
Source File: EffectTrack.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** * This method clone the Track and search for the cloned counterpart of the * original emmitter in the given cloned spatial. The spatial is assumed to * be the Spatial holding the AnimControl controling the animation using * this Track. * * @param spatial the Spatial holding the AnimControl * @return the cloned Track with proper reference */ public Track cloneForSpatial(Spatial spatial) { EffectTrack effectTrack = new EffectTrack(); effectTrack.particlesPerSeconds = this.particlesPerSeconds; effectTrack.length = this.length; effectTrack.startOffset = this.startOffset; //searching for the newly cloned ParticleEmitter effectTrack.emitter = findEmitter(spatial); if (effectTrack.emitter == null) { logger.log(Level.WARNING, "{0} was not found in {1} or is not bound to this track", new Object[]{emitter.getName(), spatial.getName()}); effectTrack.emitter = emitter; } removeUserData(this); //setting user data on the new emmitter and marking it with a reference to the cloned Track. setUserData(effectTrack); effectTrack.emitter.setParticlesPerSec(0); return effectTrack; }
Example #6
Source File: VehicleEditorController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void resultChanged(LookupEvent ev) { boolean cleared = false; for (Iterator<? extends JmeSpatial> it = result.allInstances().iterator(); it.hasNext();) { JmeSpatial jmeSpatial = it.next(); selectedSpat = jmeSpatial; Spatial spat = jmeSpatial.getLookup().lookup(Spatial.class); toolController.updateSelection(spat); Geometry geom = jmeSpatial.getLookup().lookup(Geometry.class); if (geom != null) { if (!cleared) { list.clear(); cleared = true; } Logger.getLogger(VehicleEditorController.class.getName()).log(Level.INFO, "adding:" + jmeSpatial.getName()); list.add(geom); } } }
Example #7
Source File: LayerNodeTree.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
/** * Notify about added a spatial. * * @param spatial the spatial. */ @FxThread public void notifyAdded(@NotNull final Spatial spatial) { spatial.depthFirstTraversal(child -> { final SceneLayer layer = SceneLayer.getLayer(child); if (layer == SceneLayer.NO_LAYER) { return; } final TreeItem<TreeNode<?>> newLayerItem = findItemForValue(getTreeView(), layer); final TreeItem<TreeNode<?>> treeItem = findItemForValue(getTreeView(), child); if (newLayerItem != null && treeItem == null) { final TreeNode<?> objectNode = FACTORY_REGISTRY.createFor(child); newLayerItem.getChildren().add(new TreeItem<>(objectNode)); } }, Spatial.DFSMode.POST_ORDER); }
Example #8
Source File: SceneLayerTreeNode.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread public @NotNull Array<TreeNode<?>> getChildren(@NotNull final NodeTree<?> nodeTree) { final SceneLayer element = getElement(); final Array<TreeNode<?>> result = ArrayFactory.newArray(TreeNode.class); final ModelChangeConsumer changeConsumer = (ModelChangeConsumer) notNull(nodeTree.getChangeConsumer()); final Spatial currentModel = changeConsumer.getCurrentModel(); currentModel.depthFirstTraversal(spatial -> { final SceneLayer layer = SceneLayer.getLayer(spatial); if(layer == element) { result.add(FACTORY_REGISTRY.createFor(spatial)); } }); return result; }
Example #9
Source File: SceneToolController.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
protected void attachPhysicsSelection(Spatial geom) { PhysicsCollisionObject control = geom.getControl(RigidBodyControl.class); if (control == null) { control = geom.getControl(VehicleControl.class); } if (control == null) { control = geom.getControl(GhostControl.class); } if (control == null) { control = geom.getControl(CharacterControl.class); } if (control == null) { return; } Spatial selectionGeometry = DebugShapeFactory.getDebugShape(control.getCollisionShape()); if (selectionGeometry != null) { selectionGeometry.setMaterial(blueMat); selectionGeometry.setLocalTransform(geom.getWorldTransform()); toolsNode.attachChild(selectionGeometry); selectionShape = selectionGeometry; } }
Example #10
Source File: SceneFileEditor.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread protected void handleRemovedObject(@NotNull final Spatial model) { super.handleRemovedObject(model); if (!(model instanceof SceneNode)) { return; } final SceneNode sceneNode = (SceneNode) model; final SceneEditor3DPart editor3DState = getEditor3DPart(); sceneNode.getFilters().stream() .filter(ScenePresentable.class::isInstance) .forEach(filter -> editor3DState.removePresentable((ScenePresentable) filter)); sceneNode.getAppStates().stream() .filter(ScenePresentable.class::isInstance) .forEach(state -> editor3DState.removePresentable((ScenePresentable) state)); }
Example #11
Source File: TerrainQuad.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public int collideWith(Collidable other, CollisionResults results){ int total = 0; if (other instanceof Ray) return collideWithRay((Ray)other, results); // if it didn't collide with this bbox, return if (other instanceof BoundingVolume) if (!this.getWorldBound().intersects((BoundingVolume)other)) return total; for (Spatial child : children){ total += child.collideWith(other, results); } return total; }
Example #12
Source File: AbstractPhysicsDebugControl.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Apply the specified location and orientation to the specified spatial. * * @param worldLocation location vector (in physics-space coordinates, not * null, unaffected) * @param worldRotation orientation (in physics-space coordinates, not null, * unaffected) * @param spatial where to apply (may be null) */ protected void applyPhysicsTransform(Vector3f worldLocation, Quaternion worldRotation, Spatial spatial) { if (spatial != null) { Vector3f localLocation = spatial.getLocalTranslation(); Quaternion localRotationQuat = spatial.getLocalRotation(); if (spatial.getParent() != null) { localLocation.set(worldLocation).subtractLocal(spatial.getParent().getWorldTranslation()); localLocation.divideLocal(spatial.getParent().getWorldScale()); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().multLocal(localLocation); localRotationQuat.set(worldRotation); tmp_inverseWorldRotation.set(spatial.getParent().getWorldRotation()).inverseLocal().mult(localRotationQuat, localRotationQuat); spatial.setLocalTranslation(localLocation); spatial.setLocalRotation(localRotationQuat); } else { spatial.setLocalTranslation(worldLocation); spatial.setLocalRotation(worldRotation); } } }
Example #13
Source File: PreviewAssetAction.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
public void actionPerformed(ActionEvent ev) { ProjectAssetManager pm = context.getLookup().lookup(ProjectAssetManager.class); if (pm == null) { Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, "AssetManager not found!"); return; } Element assetElement = context.getLookup().lookup(Element.class); com.jme3.scene.Node node = new com.jme3.scene.Node("PreviewRootNode"); Spatial model = null; model = AssetPackLoader.loadAssetPackModel(pm, new AssetConfiguration(assetElement)); node.attachChild(model); JmeNode jmeNode = NodeUtility.createNode(node); SceneApplication app = SceneApplication.getApplication(); SceneRequest request = new SceneRequest(app, jmeNode, pm); try { request.setDataObject(DataObject.find(context.getLookup().lookup(Project.class).getProjectDirectory())); } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); } request.setWindowTitle("AssetPack - PreView Model"); app.requestScene(request); }
Example #14
Source File: ModelFileEditor.java From jmonkeybuilder with Apache License 2.0 | 6 votes |
@Override @FxThread public void notifyFxAddedChild(@NotNull final Object parent, @NotNull final Object added, final int index, final boolean needSelect) { super.notifyFxAddedChild(parent, added, index, needSelect); final ModelEditor3DPart editor3DState = getEditor3DPart(); if (added instanceof Spatial) { final Spatial spatial = (Spatial) added; final boolean isSky = spatial.getQueueBucket() == RenderQueue.Bucket.Sky; if (isSky) { editor3DState.addCustomSky(spatial); editor3DState.updateLightProbe(); } } EXECUTOR_MANAGER.addFxTask(() -> getBulletState().notifyAdded(added)); }
Example #15
Source File: PhysicsSpace.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** * adds an object to the physics space * @param obj the PhysicsControl or Spatial with PhysicsControl to add */ public void add(Object obj) { if (obj instanceof PhysicsControl) { ((PhysicsControl) obj).setPhysicsSpace(this); } else if (obj instanceof Spatial) { Spatial node = (Spatial) obj; PhysicsControl control = node.getControl(PhysicsControl.class); control.setPhysicsSpace(this); } else if (obj instanceof PhysicsCollisionObject) { addCollisionObject((PhysicsCollisionObject) obj); } else if (obj instanceof PhysicsJoint) { addJoint((PhysicsJoint) obj); } else { throw (new UnsupportedOperationException("Cannot add this kind of object to the physics space.")); } }
Example #16
Source File: AudioTrack.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 6 votes |
/** * This method clone the Track and search for the cloned counterpart of the * original audio node in the given cloned spatial. The spatial is assumed * to be the Spatial holding the AnimControl controling the animation using * this Track. * * @param spatial the Spatial holding the AnimControl * @return the cloned Track with proper reference */ public Track cloneForSpatial(Spatial spatial) { AudioTrack audioTrack = new AudioTrack(); audioTrack.length = this.length; audioTrack.startOffset = this.startOffset; //searching for the newly cloned AudioNode audioTrack.audio = findAudio(spatial); if (audioTrack.audio == null) { logger.log(Level.WARNING, "{0} was not found in {1} or is not bound to this track", new Object[]{audio.getName(), spatial.getName()}); audioTrack.audio = audio; } //setting user data on the new AudioNode and marking it with a reference to the cloned Track. setUserData(audioTrack); return audioTrack; }
Example #17
Source File: SimpleWanderBehavior.java From MonkeyBrains with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param spatial active spatial during excecution of behavior * @see SimpleWanderBehavior#SimpleWanderBehavior(com.jme3.ai.agents.Agent, float, float, float) */ public SimpleWanderBehavior(Agent agent, float rX, float rY, float rZ, Spatial spatial) { super(agent, spatial); velocity = new Vector3f(); timeInterval = 2f; maxRandSteer.x = rX; maxRandSteer.y = rY; maxRandSteer.z = rZ; }
Example #18
Source File: TestPhysicsCharacter.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { // activate physics bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); // init a physical test scene PhysicsTestHelper.createPhysicsTestWorldSoccer(rootNode, assetManager, bulletAppState.getPhysicsSpace()); setupKeys(); // Add a physics character to the world physicsCharacter = new CharacterControl(new CapsuleCollisionShape(0.5f, 1.8f), .1f); physicsCharacter.setPhysicsLocation(new Vector3f(0, 1, 0)); characterNode = new Node("character node"); Spatial model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml"); model.scale(0.25f); characterNode.addControl(physicsCharacter); getPhysicsSpace().add(physicsCharacter); rootNode.attachChild(characterNode); characterNode.attachChild(model); // set forward camera node that follows the character camNode = new CameraNode("CamNode", cam); camNode.setControlDir(ControlDirection.SpatialToCamera); camNode.setLocalTranslation(new Vector3f(0, 1, -5)); camNode.lookAt(model.getLocalTranslation(), Vector3f.UNIT_Y); characterNode.attachChild(camNode); //disable the default 1st-person flyCam (don't forget this!!) flyCam.setEnabled(false); }
Example #19
Source File: JmeSpatial.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public JmeSpatial(Spatial spatial, JmeSpatialChildren factory) { super(factory); this.jmeChildren = factory; this.spatial = spatial; getLookupContents().add(spatial); getLookupContents().add(this); super.setName(spatial.getName()); }
Example #20
Source File: RagUtils.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Enumerate all animated meshes in the specified subtree of a scene graph. * Note: recursive! * * @param subtree which subtree (aliases created) * @param storeResult (added to if not null) * @return an expanded list (either storeResult or a new instance) */ static List<Mesh> listAnimatedMeshes(Spatial subtree, List<Mesh> storeResult) { if (storeResult == null) { storeResult = new ArrayList<>(10); } if (subtree instanceof Geometry) { Geometry geometry = (Geometry) subtree; Mesh mesh = geometry.getMesh(); VertexBuffer indices = mesh.getBuffer(VertexBuffer.Type.BoneIndex); boolean hasIndices = indices != null; VertexBuffer weights = mesh.getBuffer(VertexBuffer.Type.BoneWeight); boolean hasWeights = weights != null; if (hasIndices && hasWeights && !storeResult.contains(mesh)) { storeResult.add(mesh); } } else if (subtree instanceof Node) { Node node = (Node) subtree; List<Spatial> children = node.getChildren(); for (Spatial child : children) { listAnimatedMeshes(child, storeResult); } } return storeResult; }
Example #21
Source File: TestSkyLoading.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
public void simpleInitApp() { Texture west = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_west.jpg"); Texture east = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_east.jpg"); Texture north = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_north.jpg"); Texture south = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_south.jpg"); Texture up = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_up.jpg"); Texture down = assetManager.loadTexture("Textures/Sky/Lagoon/lagoon_down.jpg"); Spatial sky = SkyFactory.createSky(assetManager, west, east, north, south, up, down); rootNode.attachChild(sky); }
Example #22
Source File: TerrainUtils.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
/** * Re-attach the camera to the LOD control. * Called when the scene is opened and will only * update the control if there is already a terrain present in * the scene. */ public static void enableLodControl(Camera camera, Node rootNode) { Terrain terrain = (Terrain) findTerrain(rootNode); if (terrain == null) return; TerrainLodControl control = ((Spatial)terrain).getControl(TerrainLodControl.class); if (control != null) { control.setCamera(camera); } }
Example #23
Source File: TestEnvironmentMapping.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
@Override public void simpleInitApp() { final Node buggy = (Node) assetManager.loadModel("Models/Buggy/Buggy.j3o"); TextureKey key = new TextureKey("Textures/Sky/Bright/BrightSky.dds", true); key.setGenerateMips(true); key.setAsCube(true); final Texture tex = assetManager.loadTexture(key); for (Spatial geom : buggy.getChildren()) { if (geom instanceof Geometry) { Material m = ((Geometry) geom).getMaterial(); m.setTexture("EnvMap", tex); m.setVector3("FresnelParams", new Vector3f(0.05f, 0.18f, 0.11f)); } } flyCam.setEnabled(false); ChaseCamera chaseCam = new ChaseCamera(cam, inputManager); chaseCam.setLookAtOffset(new Vector3f(0,0.5f,-1.0f)); buggy.addControl(chaseCam); rootNode.attachChild(buggy); rootNode.attachChild(SkyFactory.createSky(assetManager, tex, false)); FilterPostProcessor fpp = new FilterPostProcessor(assetManager); BloomFilter bf = new BloomFilter(BloomFilter.GlowMode.Objects); bf.setBloomIntensity(2.3f); bf.setExposurePower(0.6f); fpp.addFilter(bf); viewPort.addProcessor(fpp); }
Example #24
Source File: NewSpatialPopup.java From MikuMikuStudio with BSD 2-Clause "Simplified" License | 5 votes |
private void addSpatialUndo(final Node undoParent, final Spatial undoSpatial) { //add undo if (undoParent != null && undoSpatial != null) { Lookup.getDefault().lookup(SceneUndoRedoManager.class).addEdit(this, new AbstractUndoableSceneEdit() { @Override public void sceneUndo() throws CannotUndoException { undoSpatial.removeFromParent(); } @Override public void sceneRedo() throws CannotRedoException { undoParent.attachChild(undoSpatial); } @Override public void awtRedo() { dataObject.setModified(true); jmeNode.refresh(true); } @Override public void awtUndo() { dataObject.setModified(true); jmeNode.refresh(true); } }); } }
Example #25
Source File: MaterialDebugAppState.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Will reload the spatial's materials whenever the trigger is fired * @param trigger the trigger * @param spat the spatial to reload */ public void registerBinding(Trigger trigger, final Spatial spat) { if(spat instanceof Geometry){ GeometryBinding binding = new GeometryBinding(trigger, (Geometry)spat); bindings.add(binding); if (isInitialized()) { bind(binding); } }else if (spat instanceof Node){ for (Spatial child : ((Node)spat).getChildren()) { registerBinding(trigger, child); } } }
Example #26
Source File: CohesionBehavior.java From MonkeyBrains with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param spatial active spatial during excecution of behavior * @see CohesionBehavior#CohesionBehavior(com.jme3.ai.agents.Agent, * java.util.List) */ public CohesionBehavior(Agent agent, Spatial spatial) { super(agent, spatial); try { this.neighbours = convertToGameEntities(agent.getTeam().getMembers()); } catch (NullPointerException npe) { throw new AgentExceptions.TeamNotFoundException(agent); } }
Example #27
Source File: MapDrawer.java From OpenRTS with MIT License | 5 votes |
private void attachManmadeCliff(Cliff c) { Node n = new Node(); tilesSpatial.get(c.getTile()).add(n); castAndReceiveNode.attachChild(n); ManmadeFace face = (ManmadeFace) (c.face); Spatial s = getModel(face.modelPath); if (s == null) { logger.warning("Can't find model " + face.modelPath); return; } switch (c.type) { case Orthogonal: s.rotate(0, 0, (float) (c.angle + AngleUtil.RIGHT)); break; case Salient: s.rotate(0, 0, (float) (c.angle + AngleUtil.RIGHT)); break; case Corner: s.rotate(0, 0, (float) (c.angle)); break; default: break; } s.scale(0.005f); s.setLocalTranslation((float)c.getTile().getCoord().x + 0.5f, (float)c.getTile().getCoord().y + 0.5f, (float) (c.level * Tile.STAGE_HEIGHT) + 0.1f); n.attachChild(s); }
Example #28
Source File: LayerComparator.java From Lemur with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void setLayer( Spatial s, int layer ) { if( layer == 0 ) { s.setUserData(LAYER, null); } else { s.setUserData(LAYER, layer); } }
Example #29
Source File: AlignmentBehavior.java From MonkeyBrains with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @see AlignmentBehavior#AlignmentBehavior(com.jme3.ai.agents.Agent, * java.util.List) * @see AlignmentBehavior#AlignmentBehavior(com.jme3.ai.agents.Agent, * java.util.List, float, float) */ public AlignmentBehavior(Agent agent, List<GameEntity> neighbours, float maxDistance, float maxAngle, Spatial spatial) { super(agent, spatial); this.validateMaxDistance(maxDistance); this.neighbours = neighbours; this.maxDistance = maxDistance; this.maxAngle = maxAngle; }
Example #30
Source File: AlignmentBehavior.java From MonkeyBrains with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Neighbours of agent will be his team members. * * @param maxDistance In order to consider a neighbour inside the * neighbourhood * @param maxAngle In order to consider a neighbour inside the neighbourhood * Neighbours of agent will be his team members. * @param spatial active spatial during excecution of behavior * @param agent */ public AlignmentBehavior(Agent agent, float maxDistance, float maxAngle, Spatial spatial) { super(agent, spatial); try { this.validateMaxDistance(maxDistance); this.maxDistance = maxDistance; this.maxAngle = maxAngle; neighbours = convertToGameEntities(agent.getTeam().getMembers()); } catch (NullPointerException npe) { throw new AgentExceptions.TeamNotFoundException(agent); } }