|
|
|
@ -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; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|