Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_ResourceContainerVirtual.c
Go to the documentation of this file.
3 {
4  [Attribute(defvalue: "0 0 0", uiwidget: UIWidgets.Coords, params: "inf inf purpose=coords space=entity")]
5  protected vector m_vBoundingVolumeMins;
6 
7  [Attribute(defvalue: "0 0 0", uiwidget: UIWidgets.Coords, params: "inf inf purpose=coords space=entity")]
8  protected vector m_vBoundingVolumeMaxs;
9 
10  //------------------------------------------------------------------------------------------------
11  override void GetBoundingVolume(inout vector mins, inout vector maxs)
12  {
13  mins = m_vBoundingVolumeMins;
14  maxs = m_vBoundingVolumeMaxs;
15  }
16 
17  override void GetAxisAlignedBoundingVolume(inout vector mins, inout vector maxs)
18  {
19  if (!m_Owner)
20  return;
21 
22  vector mat[3];
23 
24  m_Owner.GetWorldTransform(mat);
25 
26  vector p1 = m_vBoundingVolumeMins;
27  vector p2 = m_vBoundingVolumeMaxs;
28  vector p3 = p1;
29  vector p4 = p2;
30 
31  p3[2] = p3[2] + p2[2];
32  p4[2] = p4[2] + p1[2];
33 
34  p1 = p1.Multiply3(mat);
35  p2 = p2.Multiply3(mat);
36  p3 = p3.Multiply3(mat);
37  p4 = p4.Multiply3(mat);
38 
39  float minX = Math.Min(Math.Min(Math.Min(p1[0], p2[0]), p3[0]), p4[0]);
40  float maxX = Math.Max(Math.Max(Math.Max(p1[0], p2[0]), p3[0]), p4[0]);
41  float minZ = Math.Min(Math.Min(Math.Min(p1[2], p2[2]), p2[2]), p4[2]);
42  float maxZ = Math.Max(Math.Max(Math.Max(p1[2], p2[2]), p2[2]), p4[2]);
43 
44  mins = Vector(minX, p1[1], minZ);
45  maxs = Vector(maxX, p2[1], maxZ);
46  }
47 
48  //------------------------------------------------------------------------------------------------
49  override void CopyFromContainer(notnull SCR_ResourceContainer container)
50  {
51  super.CopyFromContainer(container);
52 
53  SCR_ResourceContainerVirtual containerCasted = SCR_ResourceContainerVirtual.Cast(container);
54 
55  m_vBoundingVolumeMins = containerCasted.m_vBoundingVolumeMins;
56  m_vBoundingVolumeMaxs = containerCasted.m_vBoundingVolumeMaxs;
57  }
58 
59  //------------------------------------------------------------------------------------------------
60  override bool IsInRange(vector origin, float range)
61  {
62  return Math3D.IntersectionSphereAABB(origin - m_Owner.GetOrigin(), range, m_vBoundingVolumeMins, m_vBoundingVolumeMaxs);
63  }
64 
65  //------------------------------------------------------------------------------------------------
66  override void DebugDraw(bool shouldShowRange = true)
67  {
68  super.DebugDraw(shouldShowRange);
69 
70  if (!m_Owner)
71  return;
72 
73  Color color1 = GetDebugColor();
74  Color color2 = GetDebugColor();
75  vector containerMat[4];
76 
77  m_Owner.GetWorldTransform(containerMat);
78  color1.SetA(0.5);
79  color2.SetR(0.0);
80  color2.SetG(0.0);
81  color2.SetB(0.0);
82  color2.SetA(1.0);
83  Shape.Create(ShapeType.BBOX, color1.PackToInt(), ShapeFlags.ONCE | ShapeFlags.DEPTH_DITHER | ShapeFlags.TRANSP | ShapeFlags.DOUBLESIDE, m_vBoundingVolumeMins, m_vBoundingVolumeMaxs).SetMatrix(containerMat);
84  containerMat[0] = containerMat[0] * 1.05;
85  containerMat[1] = containerMat[1] * 1.05;
86  containerMat[2] = containerMat[2] * 1.05;
87  Shape.Create(ShapeType.BBOX, color2.PackToInt(), ShapeFlags.ONCE | ShapeFlags.DEPTH_DITHER | ShapeFlags.WIREFRAME, m_vBoundingVolumeMins, m_vBoundingVolumeMaxs).SetMatrix(containerMat);
88  }
89 }
GetDebugColor
Color GetDebugColor()
Definition: SCR_ResourceComponent.c:848
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ResourceContainer
Definition: SCR_ResourceContainer.c:34
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
m_Owner
SCR_AIGroupUtilityComponentClass m_Owner
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
SCR_ResourceContainerVirtual
Definition: SCR_ResourceContainerVirtual.c:2