MCPcopy Create free account
hub / github.com/OGSR/OGSR-Engine / Affect

Method Affect

ogsr_engine/xrGame/HairsZone.cpp:61–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

59}
60
61void CHairsZone::Affect(SZoneObjectInfo* O)
62{
63 CPhysicsShellHolder* pGameObject = smart_cast<CPhysicsShellHolder*>(O->object);
64 if (!pGameObject)
65 return;
66
67 if (O->zone_ignore)
68 return;
69
70 Fvector P;
71 XFORM().transform_tiny(P, CFORM()->getSphere().P);
72
73#ifdef DEBUG
74 if (bDebug)
75 {
76 char l_pow[255];
77 sprintf_s(l_pow, "zone hit. %.1f", Power(pGameObject->Position().distance_to(P)));
78 Msg("%s %s", *pGameObject->cName(), l_pow);
79 }
80#endif
81
82 Fvector hit_dir;
83 hit_dir.set(::Random.randF(-.5f, .5f), ::Random.randF(.0f, 1.f), ::Random.randF(-.5f, .5f));
84 hit_dir.normalize();
85
86 Fvector position_in_bone_space;
87
88 P.y = pGameObject->Position().y;
89 float power = Power(pGameObject->Position().distance_to(P));
90 float impulse = m_fHitImpulseScale * power * pGameObject->GetMass();
91
92 //статистика по объекту
93 O->total_damage += power;
94 O->hit_num++;
95
96 if (power > 0.01f)
97 {
98 m_dwDeltaTime = 0;
99 position_in_bone_space.set(0.f, 0.f, 0.f);
100
101 CreateHit(pGameObject->ID(), ID(), hit_dir, power, 0, position_in_bone_space, impulse, m_eHitTypeBlowout);
102
103 PlayHitParticles(pGameObject);
104 }
105}

Callers

nothing calls this directly

Calls 13

XFORMFunction · 0.85
CFORMFunction · 0.85
PowerFunction · 0.85
MsgFunction · 0.85
IDFunction · 0.85
transform_tinyMethod · 0.80
PositionMethod · 0.80
randFMethod · 0.80
distance_toMethod · 0.45
cNameMethod · 0.45
setMethod · 0.45
normalizeMethod · 0.45

Tested by

no test coverage detected