Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
AttachBoneRotationTrackModifier.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 vector transform[4];
10 vector boneTransform[4];
11 vector originalVector[4];
12 ChimeraWorld chimeraWorld;
13
14 override void OnInit(World world)
15 {
16 chimeraWorld = world;
17 }
18
19 override vector OnApplyModifierVector(float time, vector originalValue)
20 {
21
22 IEntity entity = chimeraWorld.FindEntityByName(entityToAttach);
23
24 if (!entity)
25 return originalValue;
26
27 entity.GetTransform(transform);
28
29 if (boneToAttach != "") //attach to bone
30 {
31 Animation entityAnimation = entity.GetAnimation();
32
33 if (!entityAnimation)
34 return originalValue;
35
36 TNodeId boneId = entityAnimation.GetBoneIndex(boneToAttach);
37
38 if (boneId == -1)
39 return originalValue;
40
41 entityAnimation.GetBoneMatrix(boneId, boneTransform);
42 Math3D.MatrixMultiply4(transform, boneTransform, transform);
43
44 Math3D.AnglesToMatrix(originalValue, originalVector);
45 Math3D.MatrixMultiply4(transform, originalVector, transform);
46
47 return Math3D.MatrixToAngles(transform);
48 }
49
50 return originalValue;
51 }
52};
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