🎨
UVC
  • Introduction
  • Installation
    • Installing in New Project
    • Installing in Existing Project - SCK
    • Installing in Existing Project - MCK
  • Space Combat Kit Tour
  • Mech Combat Kit Tour
  • Player Setup
  • Vehicle Framework
    • Game Agents
    • Vehicles
    • Modules
      • Module Mounts
      • Modules
      • Module Types
      • Module Attachments
      • Display Module On UI
      • Module Managers
  • Input
    • General Input
    • Vehicle Input
    • Rewired Integration
  • Player/AI
  • Spaceships
    • Speed UI
    • Space Fighters
    • Capital Ships
  • Mechs
    • Speed UI
  • Vehicle Control Animations
  • Character Enter/Exit
  • Camera
    • Camera Setup
    • Vehicle Setup
    • Secondary Cameras
    • Death Camera
  • Weapons
    • Framework
      • Triggerables System
      • Weapon System
    • Vehicle Setup
      • Vehicle Weapons
      • Cursor Aiming
    • Projectile Weapons
    • Beam Weapons
    • Missile Weapons
    • Resource Handling (Ammo/Heat)
    • Turrets
    • HUD Weapon Info
    • Health Modifier Volumes
  • Radar
    • Radar Setup
    • Target Setup
    • Target Selectors
    • Trackable Types
    • Improving Radar Performance
    • Target Notification
    • Radar Audio
  • Health
    • Health Framework
      • Health
      • Damageable
      • Damage Receiver
      • Health Modifier
      • Health Types
      • Health Modifier Types
      • Surface Types
    • Vehicle Setup
    • Damageable Object Setup
    • Detonators
    • Health Recharge
    • Health UI
    • Energy Shield
    • Damageable Module Linkers
  • HUD
    • HUD Basics
    • HUD Manager Setup
    • Custom HUD Components
    • HUD Module Display
    • Camera View Management
    • HUD Cursor / Reticle
    • Weapon UI
    • Resource Container UI
    • 2D Radar
    • 3D Radar
    • Target Boxes
    • Target Holograms
    • Minimaps
    • HUD Distance Lookup
  • Loadout
  • AI - Space Combat Kit
    • AI Setup
    • AI Spaceship Behaviours
  • AI - Mech Combat Kit
  • Game States
  • Teams
  • Floating Origin
  • Object Pooling
  • Menus
    • Creating Menus
    • Button Controllers
  • Rumbles
  • Rigidbody Characters [WIP]
  • Utilities [WIP]
    • Object Triggers
    • Shadow Caster Doubles
    • Gimbals
    • Game State Post Process Enabler
  • Objectives
  • Resources System
    • Resource Containers
    • Resource Handlers
    • Resource Container Triggers
    • Module/Vehicle Resource Usage
    • UI
  • Cutscenes
  • URP Upgrading
Powered by GitBook
On this page
  • Accessing Gun/Missile Weapons
  • Selected Target
  • Turrets
  • Lead Target Positions

Was this helpful?

  1. Weapons
  2. Vehicle Setup

Vehicle Weapons

The Weapons component provides key weapon functionality to a vehicle, and a vehicle should have this component added to the root transform.

Accessing Gun/Missile Weapons

The Weapons component gets all the weapons on the vehicle at the start as well as any loaded onto the vehicle during gameplay and stores them in the Gun Weapons and Missile Weapons lists. You can access them like so.

// Get the list of gun weapons
List<GunWeapon> gunWeapons = myWeapons.GunWeapons;

// Get the list of missile weapons
List<MissileWeapon> missileWeapons = myWeapons.MissileWeapons;

Selected Target

The Weapons Target Selector is the target selector that defines the target for gun lead target calculations and missile locking, and also defines the target that an AI will attack.

Set it in the inspector of the Weapons component.

You can access the selected target on the Weapons component like so:

// Get the selected target
Trackable selectedTarget = myWeapons.Target;

Turrets

The Weapons component accesses and stores all the turrets on the vehicle and aims them at the Turret Target Transform defined in the inspector.

With the Turrets Mode setting, you can define how turrets on the vehicle are handled:

  • Independent - the turret is left to its own devices to acquire targets and fire at them

  • Manual - the turret is aimed and fired by the vehicle

  • Auto - the turret target is provided by the Weapons Target Selector but it decides when to fire

Lead Target Positions

When a target is moving very fast across the line of sight, projectile weapons must be aimed ahead of it to hit it. Exactly where to aim is calculated as the lead target position. You can access the lead target information on the Weapons component like so:

// Get the lead target positions for each gun weapon in the Gun Weapons list
Vector3[] leadTargetPositions = myWeapons.LeadTargetPositions;

// Get the average lead target position, providing the target's actual position and velocity
Vector3 averageLeadTargetPosition = myWeapons.AverageLeadTargetPosition(targetPosition, targetVelocity);

PreviousVehicle SetupNextCursor Aiming

Last updated 2 years ago

Was this helpful?