Exemple #1
0
        public Vector3 DirectionToTarget(Vector3D target)
        {
            MyCharacterWeaponPositionComponent weaponPositionComponent =
                m_owner.Components.Get <MyCharacterWeaponPositionComponent>();

            Vector3D direction;

            if (weaponPositionComponent != null)
            {
                direction = Vector3D.Normalize(target - weaponPositionComponent.LogicalPositionWorld);
            }
            else
            {
                direction = Vector3D.Normalize(target - PositionComp.WorldMatrix.Translation);
            }

            Vector3D gunDirection = m_owner.WeaponPosition.LogicalOrientationWorld;
            double   d            = Vector3D.Dot(direction, gunDirection);

            //Too big angle to target
            if (d < 0.98)
            {
                direction = gunDirection;
            }
            return(direction);
        }
Exemple #2
0
        public static bool IsAimingDownSights(IMyCharacter character)
        {
            MyCharacterWeaponPositionComponent weaponPosComp = character?.Components?.Get <MyCharacterWeaponPositionComponent>();

            return(weaponPosComp != null ? weaponPosComp.IsInIronSight : false);
        }