Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
CrosshairDebug.c
Go to the documentation of this file.
1
class
SCR_CrosshairDebug
2
{
3
private
BaseWeaponManagerComponent m_WeaponManager;
4
private
ImageWidget
m_CrosshairMuzzleDebugWidget;
5
6
//------------------------------------------------------------------------------------------------
7
void
Update
(
ChimeraCharacter
owner,
float
timeSlice)
8
{
9
if
(!m_CrosshairMuzzleDebugWidget)
10
return
;
11
12
bool
debugEnabled =
DiagMenu
.GetBool(
SCR_DebugMenuID
.DEBUGUI_CHARACTER_MUZZLE_CROSSHAIR);
13
m_CrosshairMuzzleDebugWidget.SetVisible(debugEnabled);
14
15
if
(!debugEnabled)
16
return
;
17
18
vector
muzzleMat[4];
19
m_WeaponManager.GetCurrentMuzzleTransform(muzzleMat);
20
21
const
float
traceDistance = 100;
22
vector
traceStart = muzzleMat[3];
23
vector
traceEnd = muzzleMat[3] + muzzleMat[2] * traceDistance;
24
25
autoptr
TraceParam
p =
new
TraceParam
();
26
p.Start = traceStart;
27
p.End = traceEnd;
28
p.Flags =
TraceFlags
.WORLD |
TraceFlags
.ENTS;
29
p.Exclude = owner;
30
p.LayerMask =
TRACE_LAYER_CAMERA
;
31
BaseWorld
world = owner.GetWorld();
32
float
hit = world.TraceMove(p, null);
33
34
vector
endPos = hit * (traceEnd - traceStart) + traceStart;
35
vector
screenVect =
GetGame
().GetWorkspace().ProjWorldToScreen(endPos, world);
36
FrameSlot
.SetPos(m_CrosshairMuzzleDebugWidget, screenVect[0],screenVect[1]);
37
}
38
39
//------------------------------------------------------------------------------------------------
40
void
SCR_CrosshairDebug(
ChimeraCharacter
owner,
Widget
root)
41
{
42
// Detect and store weapon manager
43
m_WeaponManager = BaseWeaponManagerComponent.Cast(owner.FindComponent(BaseWeaponManagerComponent));
44
if
(!m_WeaponManager)
45
return
;
46
}
47
48
//------------------------------------------------------------------------------------------------
49
void
~SCR_CrosshairDebug()
50
{
51
}
52
};
SCR_DebugMenuID
SCR_DebugMenuID
This enum contains all IDs for DiagMenu entries added in script.
Definition
DebugMenuID.c:4
TRACE_LAYER_CAMERA
const int TRACE_LAYER_CAMERA
Definition
Constants.c:14
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
BaseWorld
Definition
BaseWorld.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
DiagMenu
Diagnostic and developer menu system.
Definition
DiagMenu.c:18
FrameSlot
Definition
FrameSlot.c:13
ImageWidget
Definition
ImageWidget.c:13
TraceParam
Definition
TraceParam.c:16
Widget
Definition
Widget.c:13
vector
Definition
vector.c:13
Update
@ Update
Definition
SndComponentCallbacks.c:14
TraceFlags
TraceFlags
Definition
TraceFlags.c:13
scripts
Game
UI
HUD
CrosshairDebug.c
Generated by
1.17.0