MIS-VehicleWeapons

About MIS-VehicleWeapons – Unity Asset Pack

MIS-VehicleWeapons Unity Asset Overview

The MIS-VehicleWeapons framework functions as an extended weapon integration architecture built to bridge character controllers, vehicle mechanics, and mounted ordnance systems. Designed specifically as an add-on module, its core architectural goal is the decoupling of physics-driven vehicle movement from high-frequency combat logic. By utilizing a modular component architecture, the system isolates weapon station operations—such as pitch/yaw tracking, ammo management, projectile instantiation, and visual feedback—from the underlying vehicular driving scripts.

At the architectural core, weapon stations are attached as child hierarchies to vehicle root objects. Rotational constraints are calculated in Local Space, preventing world-space coordinate corruption when vehicles undergo steep pitch, roll, or dynamic terrain orientation changes. Input commands rigid update loops by using delegate-driven events or direct input proxy routing, allowing either driver-controlled or dedicated passenger-gunner seats to assume weapon control without refactoring the core vehicle controller.

Component Communication & Data Flow

The structural layout relies on clear separation of concerns across key scripts:

Core Features & Performance Highlights

When deploying mounted weaponry in real-time tactical environments, performance stability is dictated by efficient memory allocation and optimized physics queries. The MIS-VehicleWeapons asset addresses these demands through specific structural design choices:

Performance Profiling Insights

In standard runtime environments executing high fire-rate mounted miniguns, memory allocation spikes are commonly caused by repeated Instantiate() and Destroy() calls for projectiles and shell casings. Integrating a generic Object Pooler for all visual tracer prefabs and particle instances stabilizes the frame timeline, eliminating garbage collection latency spikes during high-intensity combat scenes.

Integration & Setup Instructions

Configuring a vehicle hardpoint using the MIS-VehicleWeapons extension requires establishing a clean Transform hierarchy and linking the appropriate controller scripts to weapon mount points.

Step 1: Hierarchy and Pivot Alignment

Ensure your vehicle asset model maintains separated sub-mesh nodes for weapon structures. The standard required structure is:

Step 2: Component Assignment & Scripting

Attach the primary turret controller script to the Turret_Yaw_Base transform, assign the Barrel_Pitch_Mount to the pitch field, and map target crosshair queries to the firing script. Below is an example of implementing custom target alignment logic using local space calculations:

using UnityEngine;

namespace MIS.VehicleWeapons
{
    public class VehicleTurretController : MonoBehaviour
    {
        [Header("Transforms")]
        [SerializeField] private Transform turretBase;
        [SerializeField] private Transform barrelTransform;
        
        [Header("Aim Settings")]
        [SerializeField] private float rotationSpeed = 60f;
        [SerializeField] private Vector2 pitchLimits = new Vector2(-10f, 45f);

        public void ProcessAimTracking(Vector3 targetWorldPos)
        {
            if (turretBase == null || barrelTransform == null) return;

            // Compute local target for Yaw (Horizontal)
            Vector3 localTarget = turretBase.parent.InverseTransformPoint(targetWorldPos);
            Vector3 dirToTarget = (localTarget - turretBase.localPosition).normalized;

            float targetYaw = Mathf.Atan2(dirToTarget.x, dirToTarget.z) * Mathf.Rad2Deg;
            Quaternion desiredYaw = Quaternion.Euler(0f, targetYaw, 0f);
            
            turretBase.localRotation = Quaternion.RotateTowards(
                turretBase.localRotation, 
                desiredYaw, 
                rotationSpeed * Time.deltaTime
            );

            // Compute local target for Pitch (Vertical)
            Vector3 barrelLocalTarget = barrelTransform.parent.InverseTransformPoint(targetWorldPos);
            Vector3 barrelDir = (barrelLocalTarget - barrelTransform.localPosition).normalized;

            float targetPitch = -Mathf.Atan2(barrelDir.y, Mathf.Sqrt(barrelDir.x * barrelDir.x + barrelDir.z * barrelDir.z)) * Mathf.Rad2Deg;
            targetPitch = Mathf.Clamp(targetPitch, pitchLimits.x, pitchLimits.y);
            
            Quaternion desiredPitch = Quaternion.Euler(targetPitch, 0f, 0f);
            barrelTransform.localRotation = Quaternion.RotateTowards(
                barrelTransform.localRotation, 
                desiredPitch, 
                rotationSpeed * Time.deltaTime
            );
        }
    }
}

Asset Details & Specifications

CategoryAdd-Ons / Extensions
Latest Versionv1.2.6 (2 tracked releases)
File Size22.26 MB
Added to PlatformFebruary 6, 2026
Views8 views
Downloads1 downloads
Favourites0 favourites
Official StoreBuy Original License on Unity Asset Store →
Issue with Package?Report Broken Link →

Developers Who Downloaded This Also Downloaded

Related Unity Add-Ons Assets