Add NPC rendering functionality in ViewportHost
This commit is contained in:
@@ -3606,6 +3606,13 @@ export class ViewportHost {
|
||||
entity.maxDistance,
|
||||
selected
|
||||
);
|
||||
case "npc":
|
||||
return this.createNpcRenderObjects(
|
||||
entity.id,
|
||||
entity.position,
|
||||
entity.yawDegrees,
|
||||
selected
|
||||
);
|
||||
case "triggerVolume":
|
||||
return this.createTriggerVolumeRenderObjects(
|
||||
entity.id,
|
||||
@@ -3959,6 +3966,29 @@ export class ViewportHost {
|
||||
};
|
||||
}
|
||||
|
||||
private createNpcRenderObjects(
|
||||
entityId: string,
|
||||
position: Vec3,
|
||||
yawDegrees: number,
|
||||
selected: boolean,
|
||||
markerColor = selected ? NPC_SELECTED_COLOR : NPC_COLOR
|
||||
): EntityRenderObjects {
|
||||
const group = new Group();
|
||||
group.position.set(position.x, position.y, position.z);
|
||||
group.rotation.y = (yawDegrees * Math.PI) / 180;
|
||||
|
||||
const markerMeshes = createNpcMarkerMeshes(markerColor, selected);
|
||||
|
||||
for (const mesh of markerMeshes) {
|
||||
this.tagEntityMesh(mesh, entityId, "npc", group);
|
||||
}
|
||||
|
||||
return {
|
||||
group,
|
||||
meshes: markerMeshes
|
||||
};
|
||||
}
|
||||
|
||||
private createTriggerVolumeRenderObjects(
|
||||
entityId: string,
|
||||
position: Vec3,
|
||||
|
||||
Reference in New Issue
Block a user