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

◆ HitZoneSelection()

void HitZoneSelection ( )
protected

DEPRECATED.

make sure we are in range of the current weapon;

2d only

just for building and transports (big objects)

if no object in cone, set this object from raycast for these special cases

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

605 {
606 Object cursorTarget = null;
607 PlayerBase player = PlayerBase.Cast(m_DZPlayer);
608
609 // ray properties
610 vector pos;
611 vector cameraDirection = g_Game.GetCurrentCameraDirection();
612
613 MiscGameplayFunctions.GetHeadBonePos(player, pos);
614 m_RayStart = pos;
615 m_RayEnd = pos + cameraDirection * TARGETING_RAY_DIST;
616 m_RayEndShort = pos + cameraDirection * TARGETING_RAY_DIST_SHORT;
617
618 // raycast
619 set<Object> hitObjects = new set<Object>;
620 int hitComponentIndex;
621 float hitFraction;
622 vector start, end, hitNormal, hitPosObstructed;
623 PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.DEFAULT;
624
625 if ( !DayZPhysics.RaycastRV(m_RayStart, m_RayEndShort, m_HitPositionWS, hitNormal, m_HitZoneIdx, hitObjects, null, player, false, false, ObjIntersectIFire) && !DayZPhysics.RaycastRV(m_RayStart, m_RayEnd, m_HitPositionWS, hitNormal, m_HitZoneIdx, hitObjects, null, player, false, false, ObjIntersectIFire, TARGETING_RAY_RADIUS) )
626 {
627 m_HitZoneIdx = -1;
628 //Print("HitZoneSelection failed");
629 }
630 else if ( hitObjects.Count() > 0 )
631 {
632 cursorTarget = hitObjects.Get(0);
633
635 vector playerPos = m_DZPlayer.GetPosition();
636 vector hitPos = m_HitPositionWS;
638 playerPos[1] = 0;
639 hitPos[1] = 0;
640
642 if ( cursorTarget.IsAnyInherited(m_NonAlignableObjects) && vector.Distance(playerPos, hitPos) <= GetWeaponRange(m_Weapon, GetWeaponMode()))
643 {
645 if (m_TargetObject == null)
646 {
647 m_TargetObject = cursorTarget;
648 }
649 }
650
651 if (cursorTarget == m_TargetObject)
652 {
653 m_HitZoneName = cursorTarget.GetDamageZoneNameByComponentIndex(m_HitZoneIdx);
654 //Print("hit object: " + m_TargetObject + " | component idx: " + m_HitZoneIdx + " | hitzone name: " + m_HitZoneName);
655 }
656 else
657 {
659 m_HitZoneName = DEFAULT_HIT_ZONE; //Default to torso if no zone is targeted
660 }
661 }
662 else
663 {
664 m_HitZoneIdx = -1;
665 //Print("HitZoneSelection failed");
666 }
667 }
DayZGame g_Game
Определения DayZGame.c:4074
PhxInteractionLayers
Определения DayZPhysics.c:2
float GetWeaponRange(InventoryItem weapon, int weaponMode)
vector m_RayEndShort
DEPRECATED: "HitZoneSelection".
const float TARGETING_RAY_DIST_SHORT
DEPRECATED: "HitZoneSelection".
int GetWeaponMode()
const float TARGETING_RAY_DIST
DEPRECATED: "HitZoneSelection".
DayZPlayerImplement m_DZPlayer
Parent.
ref array< typename > m_NonAlignableObjects
Typenames of objects that can be targeted, but are not a priority (3rd Pass)
vector m_RayStart
Start position of most recent HitZoneSelectionRaycast.
Object m_TargetObject
Targets - types.
vector m_HitPositionWS
Most recent target position.
const string DEFAULT_HIT_ZONE
DEPRECATED: "HitZoneSelection".
int m_HitZoneIdx
Hit result - cache.
string m_HitZoneName
Most recent target HitZone name.
InventoryItem m_Weapon
Weapons - cache.
vector m_RayEnd
End position of most recent HitZoneSelectionRaycast.
const float TARGETING_RAY_RADIUS
DEPRECATED: "HitZoneSelection".
float hitFraction
Определения DustKickupEffects.c:23
Определения ZombieBase.c:2
static proto bool RaycastRV(vector begPos, vector endPos, out vector contactPos, out vector contactDir, out int contactComponent, set< Object > results=NULL, Object with=NULL, Object ignore=NULL, bool sorted=false, bool ground_only=false, int iType=ObjIntersectView, float radius=0.0, CollisionFlags flags=CollisionFlags.NEARESTCONTACT)
Raycasts world by given parameters.
Определения DayZPhysics.c:124
Определения ObjectTyped.c:2
Определения PlayerBaseClient.c:2
static proto native float Distance(vector v1, vector v2)
Returns the distance between tips of two 3D vectors.
Определения EnConvert.c:119

Перекрестные ссылки DEFAULT_HIT_ZONE, vector::Distance(), g_Game, GetWeaponMode(), GetWeaponRange(), hitFraction, m_DZPlayer, m_HitPositionWS, m_HitZoneIdx, m_HitZoneName, m_NonAlignableObjects, m_RayEnd, m_RayEndShort, m_RayStart, m_TargetObject, m_Weapon, DayZPhysics::RaycastRV(), TARGETING_RAY_DIST, TARGETING_RAY_DIST_SHORT и TARGETING_RAY_RADIUS.