Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
BoneAnimationCinematicTrack.c
Go to the documentation of this file.
1[CinematicTrackAttribute(name:"Bone Animation Track", description:"Track used for animating bones of entity slot")]
3{
4 [Attribute("")]
5 string m_sSlotName;
6
7 [Attribute("")]
8 string m_sBoneName;
9
10 [Attribute("0 0 0")]
11 vector m_YawPitchRoll;
12
13 [Attribute("0 0 0")]
14 vector m_Position;
15
16 private GenericEntity m_GeneralEntity;
17 private IEntity m_SlotEntity;
18 private World globalWorld;
19
20 override void OnInit(World world)
21 {
22 // Find particle entity by using name of track
23 findEntity(world);
24 globalWorld = world;
25 }
26
27 void findEntity(World world)
28 {
29 // Find particle entity by using name of track
30 TStringArray strs = new TStringArray;
31 GetTrackName().Split("_", strs, true);
32
33 m_GeneralEntity = GenericEntity.Cast(world.FindEntityByName(strs.Get(0)));
34 }
35
36 override void OnApply(float time)
37 {
38
39 if (globalWorld)
40 {
41 //Finding effect entity each frame for keep working in edit time
42 findEntity(globalWorld);
43 }
44
45 if (m_GeneralEntity)
46 {
47
48 //Animating bone on object
49 if (m_sSlotName == "")
50 {
51 Animation anim = m_GeneralEntity.GetAnimation();
52 int boneId = anim.GetBoneIndex(m_sBoneName);
53 anim.SetBone(m_GeneralEntity, boneId, m_YawPitchRoll, m_Position, 1.0);
54 m_GeneralEntity.Update();
55 }
56 else //Animating bone on object inside slot
57 {
58 SlotManagerComponent slotManager = SlotManagerComponent.Cast(m_GeneralEntity.FindComponent(SlotManagerComponent));
59
60 if (slotManager)
61 {
62 EntitySlotInfo entityInSlot = slotManager.GetSlotByName(m_sSlotName);
63
64 if(entityInSlot)
65 {
66 m_SlotEntity = entityInSlot.GetAttachedEntity();
67
68 if(m_SlotEntity)
69 {
70 Animation anim = m_SlotEntity.GetAnimation();
71
72 if (anim)
73 {
74 int boneId = anim.GetBoneIndex(m_sBoneName);
75 anim.SetBone(m_SlotEntity, boneId, m_YawPitchRoll, m_Position, 1.0);
76 }
77
78 m_GeneralEntity.Update();
79 }
80 }
81 }
82 }
83 }
84 }
85}
Adds ability to attach an object to a slot.
Definition World.c:16
SCR_FieldOfViewSettings Attribute
array< string > TStringArray
Definition Types.c:385