4 protected string m_sBoneName;
7 protected vector m_vOffset;
9 [
Attribute(defvalue:
"0",
desc:
"How large the widget is going to be at 1 m distance.")]
10 protected float m_bScaleCoef;
13 protected int m_iBoneIndex;
14 protected CameraManager m_CameraManager;
17 override vector UpdateSlot(
int screenW,
int screenH, vector posCenter, vector posCam)
19 if (m_iBoneIndex == -1)
20 return super.UpdateSlot(screenW, screenH, posCenter, posCam);
25 m_Owner.GetAnimation().GetBoneMatrix(m_iBoneIndex, transform);
33 if (m_bScaleCoef != 0)
34 FrameSlot.SetSize(m_Widget, m_bScaleCoef, m_bScaleCoef);
36 return ShowOffScreen(pos, screenW, screenH, posCenter);
43 if (m_bScaleCoef != 0)
45 CameraBase camera = m_CameraManager.CurrentCamera();
48 float size = (m_bScaleCoef * (70 / camera.GetVerticalFOV())) / vector.Distance(posWorld, camera.GetWorldTransformAxis(3));
49 FrameSlot.SetSize(m_Widget, size, size);
53 FrameSlot.SetPos(m_Widget, pos[0], pos[1]);
54 m_Widget.SetZOrder(vector.Distance(posWorld, posCam));
55 m_Widget.SetVisible(
true);
61 m_Widget.SetVisible(
false);
68 super.InitSlot(entity);
70 m_CameraManager =
GetGame().GetCameraManager();
73 m_iBoneIndex =
m_Owner.GetAnimation().GetBoneIndex(m_sBoneName);
75 FrameSlot.SetAlignment(m_Widget, 0.5, 0.5);