3 private BaseWeaponManagerComponent m_WeaponManager;
4 private ImageWidget m_CrosshairMuzzleDebugWidget;
7 void Update(ChimeraCharacter owner,
float timeSlice)
9 if (!m_CrosshairMuzzleDebugWidget)
12 bool debugEnabled = DiagMenu.GetBool(
SCR_DebugMenuID.DEBUGUI_CHARACTER_MUZZLE_CROSSHAIR);
13 m_CrosshairMuzzleDebugWidget.SetVisible(debugEnabled);
21 float traceDistance = 100;
22 vector traceStart = muzzleMat[3];
23 vector traceEnd = muzzleMat[3] + muzzleMat[2] * traceDistance;
25 autoptr TraceParam p =
new TraceParam();
28 p.Flags = TraceFlags.WORLD | TraceFlags.ENTS;
31 BaseWorld world = owner.GetWorld();
32 float hit = world.TraceMove(p,
null);
34 vector endPos = hit * (traceEnd - traceStart) + traceStart;
35 vector screenVect =
GetGame().GetWorkspace().ProjWorldToScreen(endPos, world);
36 FrameSlot.SetPos(m_CrosshairMuzzleDebugWidget, screenVect[0],screenVect[1]);
43 m_WeaponManager = BaseWeaponManagerComponent.Cast(owner.FindComponent(BaseWeaponManagerComponent));