Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
AttachBonePositionTrackModifier.c
Go to the documentation of this file.
2{
3 [Attribute(defvalue:"", desc:"Entity we want be attached to")]
4 string entityToAttach;
5
6 [Attribute(defvalue:"", desc:"Bone we want be attached to")]
7 string boneToAttach;
8
9 [Attribute(defvalue:"false", desc:"If we want to rotate with parent")]
10 bool applyRotation;
11
12 vector transform[4];
13 vector boneTransform[4];
14 vector originalVector[4];
15 ChimeraWorld chimeraWorld;
16
17 override void OnInit(World world)
18 {
19 chimeraWorld = world;
20 }
21
22 override vector OnApplyModifierVector(float time, vector originalValue)
23 {
24
25 IEntity entity = chimeraWorld.FindEntityByName(entityToAttach);
26
27 if (!entity)
28 return originalValue;
29
30 entity.GetTransform(transform);
31
32 if (boneToAttach != "") //attach to bone
33 {
34 Animation entityAnimation = entity.GetAnimation();
35
36 if (!entityAnimation)
37 return originalValue;
38
39 TNodeId boneId = entityAnimation.GetBoneIndex(boneToAttach);
40
41 if (boneId == -1)
42 return originalValue;
43
44 entityAnimation.GetBoneMatrix(boneId, boneTransform);
45 Math3D.MatrixMultiply4(transform, boneTransform, transform);
46
47 if (applyRotation)
48 {
49 originalVector = { "1 0 0", "0 1 0", "0 0 1", originalValue};
50 Math3D.MatrixMultiply4(transform, originalVector, transform);
51
52 return transform[3];
53 }
54 else
55 {
56 return transform[3] + originalValue;
57 }
58 }
59
60 return originalValue;
61 }
62};
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Animation GetAnimation()
proto external void GetTransform(out vector mat[])
Definition World.c:16
SCR_FieldOfViewSettings Attribute
int TNodeId
Node global id is a hash of name of the node.
Definition EnEntity.c:18