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

◆ EOnPostFrame()

override void EOnPostFrame ( IEntity other,
int extra )
protected

dust behind handling

WheelContact

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

613 {
614 if (!g_Game.IsDedicatedServer())
615 {
616 float motorbikeSpeed = GetVelocity(this).Length();
617 ParticleParamsOverrideData particleParamsData;
618
619 if (EngineIsOn())
620 {
621 if (!m_VFXComponent.IsEffectPlayed(EVehicleVFXEffect.EXHAUST_SMOKE))
622 {
623 particleParamsData = m_VFXComponent.GetParticleParamsOverrideData(EVehicleVFXEffect.EXHAUST_SMOKE);
624 particleParamsData.m_FloatModifiers.InsertAt(motorbikeSpeed, 0);
625 m_VFXComponent.PlayEffect(EVehicleVFXEffect.EXHAUST_SMOKE);
626 m_VFXComponent.SetEffectParticleState(EVehicleVFXEffect.EXHAUST_SMOKE, ParticleList.HATCHBACK_EXHAUST_SMOKE);
627 }
628 }
629 else
630 {
631 if (!g_Game.IsDedicatedServer())
632 m_VFXComponent.StopEffect(EVehicleVFXEffect.EXHAUST_SMOKE);
633 }
634
636 {
637 string surface;
638
639 if (motorbikeSpeed > EffVehicleDust.WHEEL_DUST_THRESHOLD)
640 {
641 if (particleParamsData)
642 {
643 particleParamsData.ClearAll();
644 particleParamsData = m_VFXComponent.GetParticleParamsOverrideData(EVehicleVFXEffect.DUST_BEHIND);
645 particleParamsData.m_FloatModifiers.InsertAt(motorbikeSpeed, 0);
646 particleParamsData.m_FloatModifiers.InsertAt(GetWeightCoef(), 1);
647 m_VFXComponent.PlayEffect(EVehicleVFXEffect.DUST_BEHIND);
648 }
649 }
650 else
651 m_VFXComponent.StopEffect(EVehicleVFXEffect.DUST_BEHIND);
652
653
654 int wheelCount = WheelCount();
655 TVectorArray wheelsPosition = new TVectorArray();
656
657 int i;
658 for (i = 0; i < wheelCount; ++i)
659 wheelsPosition.InsertAt(Vector(-1, -1, -1), i);
660
661 for (i = 0; i < wheelCount; ++i)
662 {
663 CarWheel wheel = CarWheel.Cast(WheelGetEntity(i));
664 if (!wheel)
665 break;
666
667 vector wheelPos;
668 if (m_VFXComponent.CanPlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE))
669 {
670 if (WheelHasContact(i))
671 {
672 float wheelSpeed = WheelGetAngularVelocity(i) * wheel.GetRadius();
673 wheelPos = WheelGetContactPosition(i);
674 wheelPos = WorldToModel(wheelPos);
675 wheelsPosition.Set(i, wheelPos);
676
677 vector wheelVel = dBodyGetVelocityAt(this, wheelPos);
678
679 vector transform[3];
680 transform[2] = WheelGetDirection(i);
681 transform[1] = vector.Up;
682 transform[0] = transform[2] * transform[1];
683
684 wheelVel = wheelVel.InvMultiply3(transform);
685
686 float bodySpeed = wheelVel[2];
687
688 bool applyWheelSmokeEffect = false;
689
690 if ((wheelSpeed > 0 && bodySpeed > 0) || (wheelSpeed < 0 && bodySpeed < 0))
691 applyWheelSmokeEffect = Math.AbsFloat(wheelSpeed) > Math.AbsFloat(bodySpeed) + EffWheelSmoke.WHEEL_SMOKE_THRESHOLD;
692 else
693 applyWheelSmokeEffect = Math.AbsFloat(wheelSpeed) > EffWheelSmoke.WHEEL_SMOKE_THRESHOLD;
694
695 if (applyWheelSmokeEffect)
696 {
697 m_VFXComponent.SetEffectGroupPositions(EVehicleVFXEffectGroup.WHEEL_SMOKE, wheelsPosition);
698 m_VFXComponent.PlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE);
699 }
700 else
701 m_VFXComponent.StopEffectGroup(EVehicleVFXEffectGroup.WHEEL_SMOKE);
702 }
703 }
704
705 // actual wheel position
706 wheelPos = WheelGetPositionLS(i);
707 wheelsPosition.Set(i, wheelPos);
708
710 {
711 if (m_VFXComponent.CanPlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT))
712 {
713 bool applyWheelContactEffect = Math.AbsFloat(wheelSpeed) > EffWheelContact.SPEED_THRESHOLD;
714 if (wheel && applyWheelContactEffect)
715 {
716 particleParamsData = m_VFXComponent.GetEffectGroupParticleParamsOverrideData(EVehicleVFXEffectGroup.WHEEL_CONTACT);
717 if (particleParamsData)
718 {
719 particleParamsData.m_FloatModifiers.InsertAt(motorbikeSpeed, 0);
720 particleParamsData.m_FloatModifiers.InsertAt(GetWeightCoef(), 1);
721
722 m_VFXComponent.SetSurfaceInfo(WheelGetSurface(i));
723 m_VFXComponent.SetEffectGroupPositions(EVehicleVFXEffectGroup.WHEEL_CONTACT, wheelsPosition);
724
725 m_VFXComponent.PlayEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT);
726 }
727 }
728 else
729 m_VFXComponent.StopEffectGroup(EVehicleVFXEffectGroup.WHEEL_CONTACT);
730 }
731 }
732
733
734 }
735 }
736 }
737 }
DayZGame g_Game
Определения DayZGame.c:4074
EVehicleVFXEffect
Identifiers of individual vehicle VFX effects.
Определения EVehicleVFXTypes.c:3
proto native vector WheelGetPositionLS(int wheelIdx)
proto native EntityAI WheelGetEntity(int wheelIdx)
proto native int WheelCount()
How many wheel can be attached to a motorbike (hubs only)
proto native bool WheelHasContact(int wheelIdx)
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
proto native vector WheelGetDirection(int wheelIdx)
proto native vector WheelGetContactPosition(int wheelIdx)
proto native SurfaceInfo WheelGetSurface(int wheelIdx)
proto native float WheelGetAngularVelocity(int wheelIdx)
ref VehicleVFXComponent m_VFXComponent
Определения MotorbikeScript.c:76
override float GetWeightCoef()
const float WHEEL_DUST_THRESHOLD
Определения VehicleDust.c:3
Определения VehicleDust.c:2
const float SPEED_THRESHOLD
Определения EffWheelContact.c:3
Определения EffWheelContact.c:2
const float WHEEL_SMOKE_THRESHOLD
Определения WheelSmoke.c:3
Определения WheelSmoke.c:2
Определения EnMath.c:7
static const int HATCHBACK_EXHAUST_SMOKE
Определения ParticleList.c:299
Определения ParticleList.c:12
proto native float Length()
Returns length of vector (magnitude)
proto vector InvMultiply3(vector mat[3])
Invert-transforms vector.
static const vector Up
Определения EnConvert.c:120
Определения EnConvert.c:119
array< vector > TVectorArray
Определения EnScript.c:738
proto native vector Vector(float x, float y, float z)
Vector constructor from components.
static proto float AbsFloat(float f)
Returns absolute value.
proto native vector dBodyGetVelocityAt(notnull IEntity body, vector globalpos)
proto native vector GetVelocity(notnull IEntity ent)
Returns linear velocity.

Перекрестные ссылки Math::AbsFloat(), dBodyGetVelocityAt(), EngineIsOn(), g_Game, GetVelocity(), GetWeightCoef(), ParticleList::HATCHBACK_EXHAUST_SMOKE, vector::InvMultiply3(), vector::Length(), m_VFXComponent, EffWheelContact::SPEED_THRESHOLD, vector::Up, Vector(), EffVehicleDust::WHEEL_DUST_THRESHOLD, EffWheelSmoke::WHEEL_SMOKE_THRESHOLD, WheelCount(), WheelGetAngularVelocity(), WheelGetContactPosition(), WheelGetDirection(), WheelGetEntity(), WheelGetPositionLS(), WheelGetSurface() и WheelHasContact().