Weapons fire projectile entities rather than instant raycasts. This allows bullets to behave like physical objects with travel time, velocity, and drop.
Each bullet is spawned as an entity and moved forward every tick to simulate flight.
//--Bullet Spawn Process-\
Player fires weapon
Plugin verifies weapon NBT
Ammo and magazine checked
Projectile entity spawned at muzzle position
Entity receives forward velocity
Entity travels forward each tick
Collision detection performed
Damage applied on impact
After impact or maximum lifetime, the projectile entity is removed.
//--Projectile Behavior-\
Bullets contain properties that control flight.
Example attributes:
speed
gravity
range
damage
penetration
These values determine how the projectile moves through the world.
//--Bullet Drop--\
Bullet drop is simulated using gravity applied each tick.
Higher velocity weapons will experience less noticeable drop, while slower weapons will arc downward.
Example concept:
velocity_y -= gravity
This allows rifles to maintain flatter trajectories while slower weapons drop more quickly.
//--Projectile Lifetime-\
Each bullet has a maximum travel distance or lifetime.
Example conditions for removal:
entity collision
maximum range reached
maximum tick lifetime exceeded
//--Shotgun Behavior-\
Shotguns spawn multiple projectile entities per shot.
Each pellet receives:
slight direction variance
ndependent velocity
independent collision detection
This produces a spread pattern using physical pellets.
//--Advantages-\
Projectile-based bullets allow:
realistic bullet drop
visible tracers
projectile travel time
ballistic tuning through velocity
more advanced weapon behavior
This system supports future expansion such as armor penetration, tracer rounds, and ricochet mechanics.