/** Detach this component's entity from its parent entity. */ protected void detachFromParentEntity() { if (parentEntity != null) { parentEntity.removeEntity(entity); RenderComponent rcEntity = (RenderComponent) entity.getComponent(RenderComponent.class); if (rcEntity != null) { rcEntity.setAttachPoint(null); } } parentEntity = null; }
/** Attach this component's entity to its parent entity. */ protected void attachToParentEntity() { if (parentEntity != null) { parentEntity.addEntity(entity); RenderComponent rcParentEntity = (RenderComponent) parentEntity.getComponent(RenderComponent.class); RenderComponent rcEntity = (RenderComponent) entity.getComponent(RenderComponent.class); if (rcParentEntity != null && rcParentEntity.getSceneRoot() != null && rcEntity != null) { rcEntity.setAttachPoint(rcParentEntity.getSceneRoot()); } } }