39 BaseGameMode gameMode =
GetGame().GetGameMode();
43 if (result)
return result;
46 GenericWorldEntity world =
GetGame().GetWorldEntity();
50 if (result)
return result;
60 if (!genericOwner)
return;
68 api.BeginEntityAction();
73 api.CreateObjectArrayVariableMember(ownerSource,
path,
"m_aPositions",
"SCR_CameraCoordinates",
index);
76 world.GetCurrentCamera(transform);
77 vector pos = transform[3];
78 vector dir = Math3D.MatrixToAngles(transform);
81 api.SetVariableValue(ownerSource,
path,
"m_vCameraPosition",
string.Format(
"%1 %2 %3", pos[0], pos[1], pos[2]));
82 api.SetVariableValue(ownerSource,
path,
"m_vCameraAngles",
string.Format(
"%1 %2 %3", dir[1], dir[0], dir[2]));
85 api.EndEntityAction();
89 return {
new WB_UIMenuItem(
"Add current camera coordinates", 0) };
93 return EEntityFrameUpdateSpecs.CALL_WHEN_ENTITY_VISIBLE;
99 GenericEntity genericOwner = GenericEntity.Cast(owner);
100 if (!genericOwner)
return;
103 if (!api || !api.IsEntitySelected(api.EntityToSource(owner)))
return;
105 const float length = 200;
106 const float width = 160;
107 const float height = 90;
110 foreach (SCR_CameraCoordinates coordinate:
m_aPositions)
112 coordinate.GetTransform(transform);
116 points[0] = transform[3];
117 points[1] = transform[3] + transform[2] * length + transform[1] * height + transform[0] * -width;
118 points[2] = transform[3] + transform[2] * length + transform[1] * height + transform[0] * width;
120 points[3] = transform[3];
121 points[4] = transform[3] + transform[2] * length + transform[1] * -height + transform[0] * width;
122 points[5] = transform[3] + transform[2] * length + transform[1] * height + transform[0] * width;
124 points[6] = transform[3];
125 points[7] = transform[3] + transform[2] * length + transform[1] * -height + transform[0] * -width;
126 points[8] = transform[3] + transform[2] * length + transform[1] * -height + transform[0] * width;
128 points[9] = transform[3];
129 points[10] = transform[3] + transform[2] * length + transform[1] * -height + transform[0] * -width;
130 points[11] = transform[3] + transform[2] * length + transform[1] * height + transform[0] * -width;
133 Shape.CreateSphere(
ARGBF(1, 1, 0, 1),
ShapeFlags.ONCE, transform[3], 1);
proto external string ToString()
Plain C++ pointer, no weak pointers, no memory management.
proto int ARGBF(float fa, float fr, float fg, float fb)
Converts <0.0, 1.0> ARGB into color.