DayZ 1.27
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 строка 602

603 {
604 Object cursorTarget = null;
605 PlayerBase player = PlayerBase.Cast(m_DZPlayer);
606
607 // ray properties
608 vector pos;
609 vector cameraDirection = GetGame().GetCurrentCameraDirection();
610
611 MiscGameplayFunctions.GetHeadBonePos(player, pos);
612 m_RayStart = pos;
613 m_RayEnd = pos + cameraDirection * TARGETING_RAY_DIST;
614 m_RayEndShort = pos + cameraDirection * TARGETING_RAY_DIST_SHORT;
615
616 // raycast
617 set<Object> hitObjects = new set<Object>;
618 int hitComponentIndex;
619 float hitFraction;
620 vector start, end, hitNormal, hitPosObstructed;
621 PhxInteractionLayers collisionLayerMask = PhxInteractionLayers.DEFAULT;
622
623 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) )
624 {
625 m_HitZoneIdx = -1;
626 //Print("HitZoneSelection failed");
627 }
628 else if ( hitObjects.Count() > 0 )
629 {
630 cursorTarget = hitObjects.Get(0);
631
633 vector playerPos = m_DZPlayer.GetPosition();
634 vector hitPos = m_HitPositionWS;
636 playerPos[1] = 0;
637 hitPos[1] = 0;
638
640 if ( cursorTarget.IsAnyInherited(m_NonAlignableObjects) && vector.Distance(playerPos, hitPos) <= GetWeaponRange(m_Weapon, GetWeaponMode()))
641 {
643 if (m_TargetObject == null)
644 {
645 m_TargetObject = cursorTarget;
646 }
647 }
648
649 if (cursorTarget == m_TargetObject)
650 {
651 m_HitZoneName = cursorTarget.GetDamageZoneNameByComponentIndex(m_HitZoneIdx);
652 //Print("hit object: " + m_TargetObject + " | component idx: " + m_HitZoneIdx + " | hitzone name: " + m_HitZoneName);
653 }
654 else
655 {
657 m_HitZoneName = DEFAULT_HIT_ZONE; //Default to torso if no zone is targeted
658 }
659 }
660 else
661 {
662 m_HitZoneIdx = -1;
663 //Print("HitZoneSelection failed");
664 }
665 }
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".
proto native vector GetCurrentCameraDirection()
Определения 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:106
proto native CGame GetGame()

Перекрестные ссылки DEFAULT_HIT_ZONE, vector::Distance(), CGame::GetCurrentCameraDirection(), GetGame(), GetWeaponMode(), GetWeaponRange(), 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.