ProjectilePreset
const ProjectilePreset = { ARROW: { gravity: 1, drag: 0.01, speed: 40 }, GRENADE: { gravity: 1.5, drag: 0.05, speed: 15, aoeRadius: 5 }, ROCKE...Preset configurations for common projectile types.
Use spread operator to apply presets to weapon fire options.
Example
import { WeaponType, ProjectilePreset } from '@three-blocks/pro';
// Fire an arrow with default arrow physics
physics.weapons.fire(towerIndex, {
type: WeaponType.PROJECTILE,
bodyType: 'kinematic',
direction: aimDir,
damage: 25,
...ProjectilePreset.ARROW,
});
// Fire a grenade with AoE
physics.weapons.fire(playerIndex, {
type: WeaponType.PROJECTILE,
bodyType: 'dynamic',
direction: throwDir,
damage: 100,
...ProjectilePreset.GRENADE,
});