Getting Started
Check out the included example scene in the Ballistics/Example/
folder.
Minimal Setup
- create a
Assets/Create/Ballistics/Ballistic Settings
object in your project folder - add an empty game object to your scene and attach a
Environment Provider
component to it- assign the
Ballistic Settings
object you have created before
- assign the
- attach a
Weapon
component to a weapon in your scene- assign a transform at the end of the weapon barrel as the
Bullet Spawn Point
(z-axis pointing forward) - create a
Assets/Create/Ballistics/Bullet Info
object in your project folder - assign this
Bullet Info
object in theWeapon
component
- assign a transform at the end of the weapon barrel as the
- calling
Shoot()
on theWeapon
component will fire a bullet (you can use theSimple Weapon Input
component, to shoot when clicking the left mouse button)
Note! As so far no impact handler or visual bullet provider is set up, you will NOT see the bullet or any impacts!
Visual Bullet Provider
Bullet Ballistics separates the ballistics simulation from the visual projectiles flying through the scene. This allows to optimize the rendering when thousands of projectiles are active simultaneously, and allows you to customize the rendering to your needs.
- create a
Assets/Create/Ballistics/Visual Bullet Providers/Pooled Bullet Provider
object, and assign a bullet prefab with aPooled Bullet
component attached - assign the new
Pooled Bullet Provider
object to theVisual Bullet Provider
field of your weapon
You should now be able to see the bullet prefab when shooting the weapon.
Impact Handler
Similar to the Visual Bullet Provider
the Impact Handler
allows you to customize what should happen on a projectile impact.
- create a
Assets/Create/Ballistics/Impact Handler/Generic Impact Handler
object in your project folder- assign the impact handler object to the
Global Impact Handler
field of yourEnvironment Provider
component
- assign the impact handler object to the
- enabling
Handle Rigidbody Forces
should cause rigidbodies to be affected by projectile impacts - adding a audio clip to the
Impact Sounds
list, will cause an impact sound at any impact of a projectile with the scene
Ballistic Materials
Ballistic Material define how a projectile will behave when interacting with a collider.
- create a
Assets/Create/Ballistic/Ballistic Material
object in your project folder- a Ballistic Material is a unity
Physic Material
with an associatedBallistic Material
object - you can promote/demote a
Physic Material
to/from aBallistic Material
by right-clicking thePhysic Material
and selectingAssets/Create/Ballistics/To BallisticMaterial
/Unlink BallisticMaterial
- a Ballistic Material is a unity
- assign a Ballistic Material to a collider by setting the
Material
field of the collider to aPhysic Material
associated with aBallistic Material
object - by change the properties of the Ballistic Material to alter the bullet interactions
For more information on each of these topics check out the following chapters.