Bullet Properties

A Bullet Properties asset determines the simulation settings of your virtual bullet. To create one, right click anywhere in your project file, go to RSB>BulletProperties. This will create a new bullet properties scriptable object asset file in your project folder.

First thing you will see is the Bullet Preset dropdown. Here, you can select from available bullet presets, such as rifle ammunition or sniper rifle ammunition, derived from real cartridges. You can also see information about the preset in the info boxes below. The properties are pretty self-explanatory, you can customize your bullet by selecting the Custom preset & setup your muzzle velocity, mass, diameter etc. other physical properties of your bullet. Most important values in here are Muzzle Velocity, and the Ballistic Coefficient. Muzzle velocity determines the speed/power of your bullet. Sniper rifle cartridges usually have muzzle velocities between 700 m/s and 1500 m/s. Ballistic coefficient determines your bullet’s power to punch through air resistance. Higher the coefficient, bullet is less affected by the air drag. Usually values between 0.2-0.8 are used. You can also determine whether your bullet will be affected by wind, spin drift or air resistance. Let’s select the SR338 Magnum from the preset dropdown to use for this tutorial.

You can create multiple BulletProperties asset files, each defining one type of a bullet you want to use in your game. You can either use presets, or set it to custom for setting your bullets physical properties yourself. However, it is a good idea to stick to realistic measurements and weights.

When you unfold the Ballistics Simulation foldout, you can visualize your bullet’s trajectory in the editor. You will see below is that the simulation requires an Environment Properties asset. Select the environment properties we just created in the section above, and you will see the trajectory of your bullet.

This simulation gives you an idea about how powerful/accurate your bullet is. It does not account for spin drift or wind, but only calculates the trajectory based on gravity, temperature, air density and air resistance. You can play with the graph settings to visualize how much your bullet will drop in different distances. Once we have our Environment Properties and Bullet Properties asset files ready, now we can start using our system.

The Environment Properties asset needed in Bullet Properties inspector is only needed for simulation purposes in the editor. You do not have to assign the field if you don't want to see the simulation in editor, it does not affect the gameplay at all. In gameplay, the Environment Properties asset will be used that was assigned to the instance of SniperAndBallisticsSystem.cs file, which will be explained in detail in the upcoming sections.

Last updated