diff --git a/src/app/babylon/controller/config-manager.ts b/src/app/babylon/controller/config-manager.ts index e724c8d..b136957 100644 --- a/src/app/babylon/controller/config-manager.ts +++ b/src/app/babylon/controller/config-manager.ts @@ -43,7 +43,10 @@ export class ConfigManager { case FacilityType.QY: case FacilityType.TPBZ: case FacilityType.DWBZ: + case FacilityType.JY_JYJ://临时 + case FacilityType.JY_YG://临时 result = true; + break; } diff --git a/src/app/babylon/model/info/model/model-info.ts b/src/app/babylon/model/info/model/model-info.ts index f89684a..eeea1de 100644 --- a/src/app/babylon/model/info/model/model-info.ts +++ b/src/app/babylon/model/info/model/model-info.ts @@ -5,6 +5,7 @@ import { EventState, Mesh, PointerDragBehavior, + Vector2, Vector3, } from '@babylonjs/core'; import { Button, Rectangle, Vector2WithInfo } from '@babylonjs/gui'; @@ -14,6 +15,8 @@ import { UIManager } from 'src/app/babylon/controller/ui-manager'; import { BabylonTool } from 'src/app/babylon/tool/babylon-tool'; import { BabylonUIStyleTool } from 'src/app/babylon/tool/babylon-ui-style-tool'; import { GizmoTool } from 'src/app/babylon/tool/gizmo-tool'; +import { TsTool } from 'src/app/babylon/tool/ts-tool'; +import { isRegularExpressionLiteral } from 'typescript'; import { ModelData } from '../../data/model-data/model-data'; @@ -26,6 +29,11 @@ export class ModelInfo { * 所有子节点 */ _models: AbstractMesh[]; + + /** + * 头部所在位置(并不是都有) + */ + head: AbstractMesh; /** * 包装盒、根节点 ,请使用modelBox 属性进行访问 */ @@ -251,8 +259,23 @@ export class ModelInfo { if (this.uiFollowRoot != null) { - this.uiFollowRoot.linkWithMesh(this.modelBox); - this.uiFollowRoot.linkOffsetY = '-50px'; + + for (let i = 0; i < this.models.length; i++) { + let l_mesh = this.models[i]; + if (TsTool.stringContain(l_mesh.name, "Head")) { + this.head = l_mesh; + break; + } + } + + if (this.head == null) { + this.uiFollowRoot.linkWithMesh(this.modelBox); + this.uiFollowRoot.linkOffsetY = '-50px'; + } + else { + this.uiFollowRoot.linkWithMesh(this.head); + } + } } @@ -285,6 +308,21 @@ export class ModelInfo { } + + + /** + * 获取头部跟随的ui所在的位置 + */ + getHeadUIPos() { + let result: Vector2 = null; + if (this.uiFollowRoot != null) { + result.x = this.uiFollowRoot.leftInPixels; + result.y = this.uiFollowRoot.topInPixels; + } + + return result; + } + } diff --git a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts index 8acf483..96c3b87 100644 --- a/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts +++ b/src/app/babylon/view/facilityinfoinscene-window/facilityinfo-ui-item.ts @@ -134,5 +134,17 @@ export class FacilityInfoUIItem { } + /** + * 获取头部UI的位置(像素) + */ + getHeadUIPos() { + if (this.modelInfo != null) { + return this.modelInfo.getHeadUIPos(); + } + else { + return null; + } + } + } \ No newline at end of file diff --git a/src/assets/images/facility/in/JY_JYJ.png b/src/assets/images/facility/in/JY_JYJ.png new file mode 100644 index 0000000..199063a Binary files /dev/null and b/src/assets/images/facility/in/JY_JYJ.png differ diff --git a/src/assets/images/facility/in/JY_YG.png b/src/assets/images/facility/in/JY_YG.png new file mode 100644 index 0000000..f377b06 Binary files /dev/null and b/src/assets/images/facility/in/JY_YG.png differ