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

◆ CreateGroundEffect()

void DustEffectManager::CreateGroundEffect ( )
inlineprotected

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

247 {
248 bool canCreateEffect = true;
249 int particleID = ParticleList.NONE;
250 vector wind = g_Game.GetWeather().GetWind();
251 float windStrength = wind.Normalize();
252 vector spawnPoint = GetGroundEffectPotentialPosition();
253
254 SurfaceInfo surfaceInfo;
255 float spawnPointHeight;
256 surfaceInfo = g_Game.GetSurfaceInfoOn(spawnPoint[0], spawnPoint[2], spawnPointHeight);
257 spawnPoint[1] = spawnPointHeight;
258
260 {
261 vector endPoint;
262 endPoint = spawnPoint + (wind * GROUND_EFFECT_END_TEST_DISTANCE);
263 SurfaceInfo endPointSurfaceInfo;
264 float endPointSurfaceHeight;
265 endPointSurfaceInfo = g_Game.GetSurfaceInfoOn(endPoint[0], endPoint[2], endPointSurfaceHeight);
266
267 if (surfaceInfo.GetSurfaceType() != endPointSurfaceInfo.GetSurfaceType())
268 {
269 canCreateEffect = false;
270 }
271 }
272
273 if (canCreateEffect)
274 {
275 particleID = surfaceInfo.GetGroundEffectParticleId();
276 if (particleID == ParticleList.NONE || particleID == ParticleList.INVALID)
277 {
278 canCreateEffect = false;
279 }
280 }
281
282 if (canCreateEffect)
283 {
284 spawnPoint[1] = GetGame().SurfaceY(spawnPoint[0],spawnPoint[2]);
285
286 ParticleSource source = ParticleManager.GetInstance().PlayInWorldEx(particleID, null, spawnPoint, "0 0 0", true);
287
288
289 float output;
290
291 GetParticleParm(source, -1, EmitorParam.LIFETIME, output);
292 GetParticleParm(source, -1, EmitorParam.SIZE, output);
293
294
299
300 vector dustOrientation = wind;
301
302 dustOrientation[0] = wind[0];
303 dustOrientation[1] = wind[2];
304
305 float yaw = dustOrientation.VectorToYaw();
306
307 vector surfaceNormal = GetGame().SurfaceGetNormal(spawnPoint[0],spawnPoint[2]);
308 float dotWithForward = vector.Dot(surfaceNormal, wind);
309
310 float pitch = Math.Atan2(-dotWithForward, surfaceNormal[1]) * Math.RAD2DEG;
311
312 dustOrientation[0] = -yaw;
313 dustOrientation[1] = 0;
314 dustOrientation[2] = -pitch;
315
316 source.SetOrientation(dustOrientation);
317 }
318 }
DayZGame g_Game
Определения DayZGame.c:4074
void ParticleManager(ParticleManagerSettings settings)
Constructor (ctor)
Определения ParticleManager.c:88
int[] SurfaceInfo
Определения SurfaceInfo.c:1
float ComputeWindBiasedValue(float windStrength, float minVal, float maxVal)
Определения DustEffectsManager.c:661
vector GetGroundEffectPotentialPosition()
Определения DustEffectsManager.c:320
const float GROUND_EFFECT_END_TEST_DISTANCE
Определения DustEffectsManager.c:50
float m_GroundEffectLifetimeMin
Определения DustEffectsManager.c:37
bool m_GroundEffectTestEndPoint
Определения DustEffectsManager.c:36
float m_GroundEffectLifetimeMax
Определения DustEffectsManager.c:38
float m_GroundEffectSizeMin
Определения DustEffectsManager.c:39
float m_GroundEffectSizeMax
Определения DustEffectsManager.c:40
proto int GetGroundEffectParticleId()
proto string GetSurfaceType()
proto float Normalize()
Normalizes vector. Returns length.
proto float VectorToYaw()
Returns yaw of vector.
DayZGame GetGame()
Определения gameplay.c:636
proto void SetParticleParm(notnull IEntity ent, int emitor, EmitorParam parameter, void value)
EmitorParam
Определения EnVisual.c:114
proto void GetParticleParm(notnull IEntity ent, int emitor, EmitorParam parameter, out void value)

Перекрестные ссылки Math::Atan2(), ComputeWindBiasedValue(), vector::Dot(), g_Game, GetGame(), SurfaceInfo::GetGroundEffectParticleId(), GetGroundEffectPotentialPosition(), GetParticleParm(), SurfaceInfo::GetSurfaceType(), GROUND_EFFECT_END_TEST_DISTANCE, ParticleList::INVALID, m_GroundEffectLifetimeMax, m_GroundEffectLifetimeMin, m_GroundEffectSizeMax, m_GroundEffectSizeMin, m_GroundEffectTestEndPoint, ParticleList::NONE, vector::Normalize(), ParticleManager(), Math::RAD2DEG, SetParticleParm() и vector::VectorToYaw().

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