769 {
770 const float CENTER_EPS = 0.3;
771 const float TORSO_TO_HEAD_OFFSET = 0.55;
772
773
775
776 float targetY;
777 PlayerBase playerTarget = PlayerBase.Cast(target);
778 if (playerTarget)
779 {
780
781 targetY = MiscGameplayFunctions.GetPlayerHeadPosition(playerTarget)[1];
782 }
783 else
784 {
785
786 vector def = target.GetDefaultHitPosition();
787 if (def != vector.Zero)
788 targetY = target.ModelToWorld(def)[1] + TORSO_TO_HEAD_OFFSET;
789 else
790 targetY = target.GetPosition()[1] + 1.0;
791 }
792
793 float diff = Math.AbsFloat(targetY - myHeadY);
794 if (diff < CENTER_EPS)
795 return 0;
796
797 if(myHeadY > targetY)
798 return -1;
799 else
800 return 1;
801 }
vector GetPosition()
Get the world position of the Effect.