DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ DrawLineOfFireMuzzleToHit()

void WeaponDebug::DrawLineOfFireMuzzleToHit ( vector begin_point,
vector camera_dir,
vector camera_pos )
inlineprivate

См. определение в файле WeaponDebug.c строка 208

209 {
210 PlayerBase player = PlayerBase.Cast(g_Game.GetPlayer());
211 if (player.IsRaised())
212 {
213 vector transform[4];
214 player.GetTransformWS(transform);
215
216 HumanCommandWeapons hcw = player.GetCommandModifier_Weapons();
217 HumanInputController hic = player.GetInputController();
218
219 float UpDownBase = hcw.GetBaseAimingAngleUD();
220 float LeftRightBase = hcw.GetBaseAimingAngleLR();
221 float UpDownOffset = hcw.GetAimingHandsOffsetUD();
222 float LeftRightOffset = hcw.GetAimingHandsOffsetLR();
223
224
225 vector aimAngles = Vector(LeftRightBase + LeftRightOffset, UpDownBase + UpDownOffset, 0.0);
226 vector plrAngles = Math3D.MatrixToAngles(transform);
227
228 vector resAngle = aimAngles + plrAngles;
229
230 vector start = camera_pos;
231 //MiscGameplayFunctions.GetHeadBonePos(player, start);
232
233 vector direction = resAngle.AnglesToVector();
234
235 float range = 50.0;
236
237 vector end = start + (direction * range);
238 vector contact;
239 vector contactDir;
240 int muz;
241
242 Debug.RemoveShape(m_HitShape);
243 if ( DayZPhysics.RaycastRV(start, end, contact, contactDir, muz, null, null, player, false, false, ObjIntersectFire, 0.0) )
244 {
245 m_TargetDistance = vector.Distance( player.GetPosition(), contact);
246 m_HitShape = Debug.DrawSphere(contact, (m_TargetDistance / 150), COLOR_YELLOW);
247 m_ShapeFireDirCamera = Debug.DrawLine(begin_point, contact, Colors.RED, ShapeFlags.NOZBUFFER );
248
249
251 {
252 if (m_CurrentMode == eWeaponDebugMode.LOCAL)
253 AddPosToCyclicBuffer(contact);//TODO change to local space
254 else
255 AddPosToCyclicBuffer(contact);
257 }
258
259 if ( m_IsFireKeyPressed )
260 {
261 Debug.RemoveShape(m_PermanentLine1);
262 Debug.RemoveShape(m_PermanentLine2);
263 m_PermanentLine1 = Debug.DrawLine(begin_point, contact, Colors.RED, ShapeFlags.NOZBUFFER );
264 m_PermanentLine2 = Debug.DrawLine(camera_pos, contact, Colors.GREEN, ShapeFlags.NOZBUFFER );
265 }
266
267
268
269
270 }
271 else
272 {
273 m_HitShape = Debug.DrawSphere(end, 0.15, COLOR_RED);
274
275 m_ShapeFireDirCamera = Debug.DrawLine(begin_point, end, Colors.GREEN, ShapeFlags.NOZBUFFER );
276 m_TargetDistance = -1;
277
279 {
280 if (m_CurrentMode == eWeaponDebugMode.LOCAL)
281 AddPosToCyclicBuffer(end);//TODO change to local space
282 else
285 }
286
287 if ( m_IsFireKeyPressed )
288 {
289 Debug.RemoveShape(m_PermanentLine1);
290 Debug.RemoveShape(m_PermanentLine2);
291 m_PermanentLine1 = Debug.DrawLine(begin_point, end, Colors.RED, ShapeFlags.NOZBUFFER );
292 m_PermanentLine2 = Debug.DrawLine(camera_pos, end, Colors.GREEN, ShapeFlags.NOZBUFFER );
293 }
294 }
295 }
296 }
string Debug()
Определения CachedEquipmentStorageBase.c:26
DayZGame g_Game
Определения DayZGame.c:4074
eWeaponDebugMode
Определения WeaponDebug.c:2
proto native float GetAimingHandsOffsetUD()
returns aiming hands up/down (y) offset angle
proto native float GetBaseAimingAngleLR()
returns base aiming angle LR - without sway/offsets/...
proto native float GetAimingHandsOffsetLR()
returns aiming hands left/right (x) offset angle
proto native float GetBaseAimingAngleUD()
returns base aiming angle UD - without sway/offsets/...
bool m_IsFireKeyPressed
Определения WeaponDebug.c:16
eWeaponDebugMode m_CurrentMode
Определения WeaponDebug.c:18
Shape m_PermanentLine2
Определения WeaponDebug.c:31
Shape m_PermanentLine1
Определения WeaponDebug.c:30
bool m_IsDrawKeyHeldDown
Определения WeaponDebug.c:15
float m_TargetDistance
Определения WeaponDebug.c:17
void AddPosToCyclicBuffer(vector pos)
Определения WeaponDebug.c:159
void OrderTrailArray()
Определения WeaponDebug.c:173
Shape m_ShapeFireDirCamera
Определения WeaponDebug.c:28
Shape m_HitShape
Определения WeaponDebug.c:26
proto vector AnglesToVector()
Converts spherical coordinates (yaw, pitch, roll in degrees) to unit length vector.
@ Colors
Определения EnWorld.c:88
const int COLOR_RED
Определения 1_Core/DayZ/constants.c:64
const int COLOR_YELLOW
Определения 1_Core/DayZ/constants.c:67
ShapeFlags
Определения EnDebug.c:126
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
void HumanCommandWeapons()
Определения human.c:1155

Перекрестные ссылки AddPosToCyclicBuffer(), vector::AnglesToVector(), COLOR_RED, COLOR_YELLOW, vector::Distance(), Debug::DrawLine(), Debug::DrawSphere(), g_Game, HumanCommandWeapons::GetAimingHandsOffsetLR(), HumanCommandWeapons::GetAimingHandsOffsetUD(), HumanCommandWeapons::GetBaseAimingAngleLR(), HumanCommandWeapons::GetBaseAimingAngleUD(), Colors::GREEN, m_CurrentMode, m_HitShape, m_IsDrawKeyHeldDown, m_IsFireKeyPressed, m_PermanentLine1, m_PermanentLine2, m_ShapeFireDirCamera, m_TargetDistance, Math3D::MatrixToAngles(), OrderTrailArray(), DayZPhysics::RaycastRV(), Colors::RED, Debug::RemoveShape() и Vector().

Используется в OnPostFrameUpdate().