Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_AICinematicLookAt.c
Go to the documentation of this file.
1
2
class
SCR_AICinematicLookAt
:
AITaskScripted
3
{
4
protected
SlotManagerComponent
m_SlotManager
;
5
protected
SCR_CharacterControllerComponent
m_ControllerComponent
;
6
protected
EntitySlotInfo
m_PointOfViewStart
;
7
protected
EntitySlotInfo
m_PointOfViewEnd
;
8
protected
TAnimGraphVariable
m_LookAtVariable
;
9
protected
CharacterAnimationComponent
m_CharacterAnimation
;
10
protected
vector
m_vLook
[4];
11
protected
vector
m_vLookEnd
[4];
12
protected
vector
m_vLookAxis
;
13
protected
ChimeraCharacter
m_Player
;
14
protected
vector
m_vPlayerPosition
[4];
15
protected
vector
m_vPlayerHeadPosition
;
16
17
//-------------------------------------------------------------------------------------------
18
protected
override
void
OnInit
(AIAgent owner)
19
{
20
m_SlotManager
= SlotManagerComponent.Cast(owner.GetControlledEntity().FindComponent(SlotManagerComponent));
21
22
if
(
m_SlotManager
)
23
{
24
m_PointOfViewStart
=
m_SlotManager
.GetSlotByName(
"PointOfViewStart"
);
25
m_PointOfViewEnd
=
m_SlotManager
.GetSlotByName(
"PointOfViewEnd"
);
26
}
27
28
m_CharacterAnimation
=
CharacterAnimationComponent
.Cast(owner.GetControlledEntity().FindComponent(
CharacterAnimationComponent
));
29
30
if
(
m_CharacterAnimation
)
31
m_LookAtVariable
=
m_CharacterAnimation
.BindVariableBool(
"Look"
);
32
33
m_ControllerComponent
=
SCR_CharacterControllerComponent
.Cast(owner.GetControlledEntity().FindComponent(
SCR_CharacterControllerComponent
));
34
}
35
36
37
//-------------------------------------------------------------------------------------------
38
protected
override
ENodeResult
EOnTaskSimulate
(AIAgent owner,
float
dt)
39
{
40
if
(!
m_ControllerComponent
)
41
return
ENodeResult
.FAIL;
42
43
if
(!
m_ControllerComponent
.IsLoitering())
44
return
ENodeResult
.FAIL;
45
46
m_Player
=
ChimeraCharacter
.Cast(
EntityUtils
.GetPlayer());
47
48
if
(!
m_Player
)
49
return
ENodeResult
.FAIL;
50
51
m_Player
.GetTransform(
m_vPlayerPosition
);
52
53
// Compute lookAt region origin
54
if
(
m_PointOfViewStart
)
55
m_PointOfViewStart
.GetWorldTransform(
m_vLook
);
56
57
if
(
m_PointOfViewEnd
)
58
m_PointOfViewEnd
.GetWorldTransform(
m_vLookEnd
);
59
60
m_vLookAxis
=
vector
.Direction(
m_vLook
[3],
m_vLookEnd
[3]);
61
m_vLookAxis
.Normalize();
62
63
if
(
Math3D
.IntersectionSphereCone(
m_vPlayerPosition
[3], 1,
m_vLook
[3],
m_vLookAxis
, 1.1))
64
{
65
m_vPlayerHeadPosition
=
m_Player
.EyePosition();
66
67
m_CharacterAnimation
.SetIKTarget(
"HeadLook"
,
"HeadLook"
, owner.GetControlledEntity().CoordToLocal(
m_vPlayerHeadPosition
), {0, 0, 0});
68
69
if
(
m_LookAtVariable
)
70
m_CharacterAnimation
.SetVariableBool(
m_LookAtVariable
,
true
);
71
}
72
else
73
{
74
if
(
m_LookAtVariable
)
75
m_CharacterAnimation
.SetVariableBool(
m_LookAtVariable
,
false
);
76
}
77
78
return
ENodeResult
.RUNNING;
79
}
80
81
//-------------------------------------------------------------------------------------------
82
static
override
bool
VisibleInPalette
()
83
{
84
return
true
;
85
}
86
87
};
TAnimGraphVariable
int TAnimGraphVariable
Definition
ECommandIDs.c:2
AITaskScripted
Definition
AITaskScripted.c:13
CharacterAnimationComponent
Definition
CharacterAnimationComponent.c:13
ChimeraCharacter
Definition
ChimeraCharacter.c:13
EntitySlotInfo
Adds ability to attach an object to a slot.
Definition
EntitySlotInfo.c:9
EntityUtils
Definition
EntityUtils.c:13
Math3D
Definition
Math3D.c:13
SCR_AICinematicLookAt
Base class for tasks which return some target from combat component.
Definition
SCR_AICinematicLookAt.c:3
SCR_AICinematicLookAt::m_ControllerComponent
SCR_CharacterControllerComponent m_ControllerComponent
Definition
SCR_AICinematicLookAt.c:5
SCR_AICinematicLookAt::m_vLookAxis
vector m_vLookAxis
Definition
SCR_AICinematicLookAt.c:12
SCR_AICinematicLookAt::m_vLookEnd
vector m_vLookEnd[4]
Definition
SCR_AICinematicLookAt.c:11
SCR_AICinematicLookAt::EOnTaskSimulate
override ENodeResult EOnTaskSimulate(AIAgent owner, float dt)
Definition
SCR_AICinematicLookAt.c:38
SCR_AICinematicLookAt::m_LookAtVariable
TAnimGraphVariable m_LookAtVariable
Definition
SCR_AICinematicLookAt.c:8
SCR_AICinematicLookAt::m_SlotManager
SlotManagerComponent m_SlotManager
Definition
SCR_AICinematicLookAt.c:4
SCR_AICinematicLookAt::m_PointOfViewEnd
EntitySlotInfo m_PointOfViewEnd
Definition
SCR_AICinematicLookAt.c:7
SCR_AICinematicLookAt::m_PointOfViewStart
EntitySlotInfo m_PointOfViewStart
Definition
SCR_AICinematicLookAt.c:6
SCR_AICinematicLookAt::VisibleInPalette
static override bool VisibleInPalette()
Definition
SCR_AICinematicLookAt.c:82
SCR_AICinematicLookAt::m_vLook
vector m_vLook[4]
Definition
SCR_AICinematicLookAt.c:10
SCR_AICinematicLookAt::m_Player
ChimeraCharacter m_Player
Definition
SCR_AICinematicLookAt.c:13
SCR_AICinematicLookAt::m_vPlayerHeadPosition
vector m_vPlayerHeadPosition
Definition
SCR_AICinematicLookAt.c:15
SCR_AICinematicLookAt::m_vPlayerPosition
vector m_vPlayerPosition[4]
Definition
SCR_AICinematicLookAt.c:14
SCR_AICinematicLookAt::OnInit
override void OnInit(AIAgent owner)
Definition
SCR_AICinematicLookAt.c:18
SCR_AICinematicLookAt::m_CharacterAnimation
CharacterAnimationComponent m_CharacterAnimation
Definition
SCR_AICinematicLookAt.c:9
SCR_CharacterControllerComponent
Definition
SCR_CharacterControllerComponent.c:36
vector
Definition
vector.c:13
ENodeResult
ENodeResult
Definition
ENodeResult.c:13
scripts
Game
AI
ScriptedNodes
Soldier
SCR_AICinematicLookAt.c
Generated by
1.17.0