🎨
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
  • Getting Started
  • Physics Control Animations
  • Vehicle Transform Animations
  • Creating Your Own Animation Components

Was this helpful?

Vehicle Control Animations

PreviousSpeed UINextCharacter Enter/Exit

Last updated 1 month ago

Was this helpful?

Sometimes, it's very difficult to create the right feel (visual feedback) for the player when they are controlling a vehicle, without interfering with the player's control of it. In these cases, it may be useful to animate the body of the vehicle relative to its own root transform, to give the player great visual feedback as to what they are doing.

For example, if you have a spaceship, you may want to animate the spaceship's body to:

  • Turn slightly in the direction the spaceship is turning, to accentuate the player's control.

  • Roll slightly in the direction of sideways movement (without the spaceship itself actually rolling).

  • Provide additional visual feedback during takeoff and landing, without interfering with the spaceship's control behavior and trajectory.

If multiple components are animating the same transform (e.g. the vehicle body) at the same time, this can cause glitches in the animation. To prevent this, the Vehicle Control Animations system has been developed.

The two key components of this system are:

  • Vehicle Control Animation: A base component for animations, which calculates a local position and a local rotation for a transform every frame.

  • Vehicle Control Animation Handler: A component that manages all the animations for a single transform, combining the positions and rotations additively and applying them to the transform.

Getting Started

To begin, add a Vehicle Control Animation Handler somewhere on your vehicle, and set the 'Vehicle Handle' in the inspector to the transform you want to animate.

Physics Control Animations

For a physics-based vehicle controller (such as in the Space Combat Kit), the Rigidbody Control Animations component provides many animation options based on the properties (such as velocity and angular velocity) of the Rigidbody.

Add this component somewhere on your vehicle, and drag it into the 'Animations' list in the inspector of the Vehicle Control Animation Handler you added earlier.

On the Rigidbody Control Animations component, customize and experiment with the settings to get the visual effect you're looking for. Each setting is tooltipped to give you a clear understanding of what it does.

Add all the animations for a particular Transform to the 'Animations' list of the Vehicle Control Animator component. Each animation component must extend the Vehicle Control Animation base class.

Vehicle Transform Animations

Sometimes you want to add an animation based not on the Rigidbody properties, but to simply play during a specific event. To do this, you can use the Vehicle Transform Animation component.

To get started, add a Vehicle Transform Animation component somewhere on your vehicle and customize the settings in the inspector.

Next, drag the Vehicle Transform Animation component into the 'Animations' list of the Vehicle Control Animator component you added earlier.

Now, whenever you call the Vehicle Transform Animation component's Action() function (which can be added to an existing Unity Event if you wish), the animation will play and be applied to the transform.

Creating Your Own Animation Components

To create your own animation component, create a new script that extends the Vehicle Control Animation base class, add it to your vehicle, and drag it into the 'Animations' list of the Vehicle Control Animator component you added earlier.

Next, in your script, calculate every frame a local position and/or a local rotation value for the transform you wish to animate.

Finally, override the GetRotation() and GetPosition() methods to return the values you calculated.

Your animation will now be applied to the vehicle during gameplay!

Add all the animations for a particular Transform to the Animations list of the Vehicle Control Animator component. Each animation component must extend the Vehicle Control Animation base class.
The Rigidbody Control Animations component provides options to animate a transform based on the Rigidbody's properties, such as velocity and angular velocity.