Component User Guide
The DPT_SiegeWeapon component provides a complete state-machine-driven weapon controller for trebuchets, catapults, ballistae, cannons, and any other projectile weapon. It shares the same destruction, audio, and debris systems as DPT_InteractiveProp, and exposes a full UnityEvent API so your Animator and AI can respond to every stage of the weapon loop without writing any additional code.
Add DPT_SiegeWeapon to the root GameObject of your weapon prefab. An AudioSource is added automatically if one is not already present.
Under Core Object Setup, assign your intact mesh GameObjects to Pristine Meshes. These are hidden when the weapon is destroyed.
Under Animated Parts & Launch Setup, assign the Transforms that your Animator will drive: **Firing Arm**, **Traverse Pivot**, **Elevation Pivot**, and **Launch Point**. Assign the sling or ammo visual to **Ammo Visual** — it is shown while loaded and hidden when the weapon fires.
For cannon-style weapons with a lit fuse, assign **Fuse Point** to the empty Transform at the touch-hole. Parent your spark mesh and fuse ParticleSystem under this Transform in the prefab, then assign the ParticleSystem to **Fuse Effect**. The fuse activates automatically when the weapon enters the Loaded state and stops the moment it fires.
Optionally assign a **Projectile Prefab** under **Combat & Firing**. Leave it empty for animation-only mode.
Set **Fire Duration** to match your fire animation clip length and **Reload Duration** to match your reload clip length.
Expand the **Expanded Unity Events** foldout and wire onFireEvent and onReloadStartEvent to the corresponding Animator.SetTrigger calls.
(Optional) Assign a **Broken Parent** to enable the full fracture destruction system — see the Fracture & Destruction section below.
(Optional) For mobile wheeled weapons or models with moving mechanical elements, add the DPT_ProceduralMechanicalDrive companion script. (Refer to the separate *Procedural Mechanical Drive Guide* to configure its dedicated wheel audio loop settings).
Press **Reset Weapon** in the Inspector toolbar to confirm all references are clean before entering Play Mode.
The Weapon State Machine
The weapon is always in exactly one of the following states. Transitions happen automatically as part of the firing loop, or can be triggered externally via the scripting API.
Idle→Moving / Aiming→Loaded→Firing→Reloading→Loaded→ ... Any state→Destroyed(on TakeDamage or DestroyWeapon)
State
Description
Exit Condition
Idle
Default resting state. No active input or sequence running.
Call Move(), AimAt(), or load when startLoaded is true.
Moving
The whole weapon is being repositioned via Move(). Purely positional translation; physical chassis audio logic is deferred to satellite modules.
Call StopMoving(). Returns to Loaded or Idle depending on startLoaded.
Aiming
Traverse or elevation input is being applied.
Call StopAiming(). Returns to Loaded or Idle.
Loaded
Weapon is armed and ready. Ammo visual is shown. Fuse Effect begins playing (if assigned). CanFire returns true.
Call Fire(), or automatically if autoFire is enabled.
Firing
Fire animation is playing. Fuse Effect is stopped. Projectile spawns at 20% through fireDuration. Ammo visual is hidden.
Automatically transitions to Reloading after fireDuration seconds.
Reloading
Reload sequence is running. Reload audio plays.
Automatically transitions to Loaded after reloadDuration seconds.
Destroyed
Weapon has been broken. All coroutines stop. Fuse Effect is stopped and cleared. Debris physics begin. Terminal — use ResetWeapon() to recover.
N/A. Call ResetWeapon() to restore (e.g. for object pooling).
Projectile Spawn Delay:
The projectile prefab is instantiated after this delay through fireDuration by default, giving the illusion that it leaves mid-swing or mid-throw rather than at the very first frame of the animation. onProjectileLaunchEvent fires at the same moment, which is the correct place to trigger any launch VFX or camera shake.
Inspector Reference
Core Object Setup
Property
Description
Pristine Meshes
The mesh GameObjects shown while the weapon is intact. These are hidden when the weapon is destroyed and the broken parent is shown in their place.
Animated Parts & Launch Setup
Property
Description
Firing Arm
The throwing arm, barrel, or any Transform that your Animator drives during the fire cycle. Not moved by the script directly — assign it so external tools can find it.
Counterweight
Optional. The counterweight or tensioner on trebuchet-style weapons, typically animated in opposition to the firing arm.
Traverse Pivot
The Transform rotated left/right when Traverse() is called. When assigned, the Scene view gizmo draws the permitted arc in green. The inspector also reveals traverse speed and angle limits.
Elevation Pivot
The Transform rotated up/down when Elevate() is called. When assigned, the inspector reveals elevation speed and angle limits. The angle of the Elevation Pivot affects the launch speed when the weapon is fired.
Ammo Visual
A GameObject (boulder, loaded bolt, cannonball) that is enabled when the weapon enters Loaded state and disabled the instant Fire() is called.
Broken Ammo Visual
The broken parent of the ammoVisual object for if the Siege Weapon breaks when loaded.
Launch Point
The Transform from which the projectile prefab is spawned and from which Fire VFX is instantiated. The Scene view gizmo draws a yellow ray showing the launch direction, scaled by launch speed. If unassigned, the weapon root is used.
Fuse Point
An empty Transform positioned at the touch-hole or fuse tip on cannon-style weapons. Parent your spark mesh and fuse ParticleSystem here. The entire Fuse Point GameObject is toggled on when the weapon enters Loaded state and off when it fires or is destroyed, so all fuse visuals activate and deactivate together with a single call.
Combat & Firing
Property
Description
Projectile Prefab
The GameObject instantiated at the Launch Point when the weapon fires. Leave empty for animation-only mode — all events still fire.
Launch Speed
The speed in m/s applied to the projectile's Rigidbody on spawn. Clamped at runtime by Min and Max Launch Speed. Controlled by the Elevation angle at launch.
Min Launch Speed
Lower clamp on Launch Speed. AdjustLaunchSpeed() will never reduce speed below this value. Default: 5 m/s.
Max Launch Speed
Upper clamp on Launch Speed. AdjustLaunchSpeed() and AimAt()'s ballistic solver will never exceed this value. Default: 60 m/s.
Launch Direction
Local-space direction of the launch force, relative to the Launch Point Transform. Default is Vector3.forward.
Fire Timing Mode
Determines whether the duration of the firing state is controlled by a hardcoded duration or calculated directly from an animation asset. Options: Manual Timer or Animation Clip.
Fire Duration
How many seconds the weapon stays in the Firing state. Contextually displayed and active only when Fire Timing Mode is configured to Manual Timer. Default: 1.2s.
Fire Animation Clip
The specific animation clip used to dynamically resolve accurate mechanical duration for the firing state sequence. Contextually displayed and active only when Fire Timing Mode is configured to Animation Clip.
Reload Timing Mode
Determines whether the duration of the reloading state sequence is controlled by a hardcoded duration or calculated directly from an animation asset. Options: Manual Timer or Animation Clip.
Reload Duration
How many seconds the reload sequence takes before the weapon returns to Loaded. Contextually displayed and active only when Reload Timing Mode is configured to Manual Timer. Default: 3s.
Reload Animation Clip
The specific animation clip used to dynamically resolve accurate mechanical duration for the reload state sequence. Contextually displayed and active only when Reload Timing Mode is configured to Animation Clip.
Ignore Projectile Collisions
When enabled, the physics engine is instructed to ignore collisions between the weapon and any projectile it spawns. Recommended for most setups. For optimal physics performance, using dedicated Project Layers to isolate weapon and projectile collision matrices is preferred.
Start Loaded
If enabled, the weapon begins Play Mode in the Loaded state rather than Idle.
Auto Fire
If enabled, the weapon fires automatically every time it reaches the Loaded state, waiting Auto Fire Interval seconds before each shot.
Auto Fire Interval
Extra pause in seconds added after each reload before auto-firing again. Visible only when Auto Fire is enabled.
Auto Reload
If enabled, the weapon begins reloading immediately after the fire sequence completes. Disable to require a manual Reload() call.
Movement & Aiming
Traverse and elevation sub-sections only appear in the Inspector when their respective pivot Transforms are assigned. If you are building a fixed weapon (a wall-mounted ballista, for example) simply leave these fields unassigned to keep the Inspector clean.
Property
Description
Traverse Speed
Degrees per second the weapon rotates left or right when Traverse() is called with a normalised input delta.
Min / Max Traverse
Angular limits in degrees relative to the weapon's initial forward direction. The Scene view gizmo draws this arc in the horizontal plane.
Elevation Speed
Degrees per second the weapon pitches up or down when Elevate() is called.
Min / Max Elevation
Angular clamp on the elevation pivot. Negative minimum allows the weapon to depress below horizontal.
Move Speed
World-space movement speed in m/s applied by Move(). Used for chassis-based repositioning transformations.
Health & Impact Damage
Property
Description
Max Health
Total structural health of the weapon. The public HealthNormalised property returns this as a 0–1 value for driving health bars or material effects.
Break On Impact
If enabled, physical collisions with other Rigidbodies can trigger destruction automatically.
Impact Velocity Threshold
The minimum relative collision speed (m/s) required to deal damage. Visible only when Break On Impact is enabled.
Fracture & Destruction
The destruction system is a direct port of the DPT_InteractiveProp fracture pipeline. When a Broken Parent is assigned, the weapon gains full debris explosion physics, directional impact forces, kinetic transfer to nearby objects, and the automatic sink-and-cleanup routine.
Broken Parent is optional. If you leave it unassigned, the weapon can still take damage and fire onDestroyedEvent — it simply will not display a fracture. This is useful for weapons you want to disable narratively without a visual shatter effect.
Hierarchy Setup
The Broken Parent should have a single root GameObject containing all debris Rigidbodies as direct or nested children. This root is deactivated by default and activated only when the weapon breaks. The script caches all Rigidbody positions and rotations at startup so ResetWeapon() can restore them cleanly.
For modular weapons with shared components such as axles, levers, or winding mechanisms that exist as separate prefabs, use Attached Debris Pieces to link their broken base transforms without needing to unpack or reparent them in the hierarchy. These pieces are reparented at runtime to the first Broken Base Piece on destruction and restored to their original parents on reset.
Fracture Physics Properties
Property
Description
Broken Parent
Root of the debris hierarchy. Activating this field unlocks all fracture properties below.
Broken Base Pieces
Rigidbodies treated as primary structural members (the main frame, chassis, or base). These receive a heavily reduced explosion force (baseForceMultiplier) to keep them grounded while smaller debris scatters.
Attached Debris Pieces
Broken base transforms belonging to modular attached objects — axles, levers, winding mechanisms — that should follow the primary broken base piece when the weapon is destroyed. These transforms are reparented to Broken Base Pieces[0] at the moment of fracture and restored to their original parents when ResetWeapon() is called. This allows modular components to remain as intact prefabs in the hierarchy while still having their debris stay physically anchored to the broken frame. If a modular component has no broken variant — such as a wheel that should remain attached to the wreckage — assign its root transform here directly and it will move with the broken base.
Explosion Force
The radial impulse applied to all non-base debris pieces at the moment of fracture.
Internal Shatter Radius
The radius of the internal shatter explosion. Pieces further away than this receive proportionally less force. Visualised as a red disc gizmo.
Explosion Y Offset
Vertical offset of the explosion origin relative to the weapon root. Raising this slightly above the base distributes force more evenly across tall structures like trebuchets.
Base Force Multiplier
Scales the explosion force applied to pieces listed in Broken Base Pieces. Keeping this very low (default: 0.08) means the base stays roughly in place while upper pieces fly.
Use Directional Impact
When enabled, the direction of the hit is factored into debris trajectories — pieces on the far side of the weapon fly away from the impact. Pairs well with projectile-triggered destruction calls.
Directional Impact Force
Additional impulse added to non-base debris in the direction of the incoming hit. Visible only when Use Directional Impact is enabled.
Show Explosion Gizmo
Toggles the explosion radius and force-scale gizmos in the Scene view while the weapon is selected.
Debris Cleanup
Property
Description
Time Before Cleanup
Seconds after destruction before debris physics are frozen and the sink routine begins.
Sink Speed
Speed in m/s at which all debris sinks into the ground during cleanup. This masks the object disappearing without a jarring pop.
Sink Duration
How many seconds the sinking animation lasts before the object is destroyed/deactivated.
Destroy On Cleanup
If true, the entire weapon GameObject is destroyed via Destroy() at the end of the sink. If false, it is deactivated instead — useful for object pooling.
Despawn Base Piece
If disabled, the base pieces listed in Broken Base Pieces are detached from the cleanup routine and left in the scene permanently. Useful when the weapon base should remain as terrain geometry.
Kinetic Transfer
On destruction, the weapon can radially push nearby lightweight Rigidbodies, simulating the shockwave of a large structure collapsing. Only objects with a mass at or below Max Pushable Mass are affected, preventing artillery from launching siege towers.
Property
Description
Transfer Kinetic Energy
Master toggle. When disabled all sub-properties are hidden.
Kinetic Transfer Radius
Radius of the overlap sphere that identifies nearby Rigidbodies. Visualised as a blue wire sphere gizmo.
Kinetic Transfer Force
Explosion force applied to each affected Rigidbody.
Kinetic Upward Modifier
Upward bias added to the explosion force direction. Increasing this gives nearby objects a slight vertical lift.
Max Pushable Mass
Rigidbodies heavier than this value are ignored entirely and will not be pushed.
Audio, VFX & Effects
To prevent audio cutoff and allow natural reverb tails, operational asset audio cues are routed through dedicated AudioSource components. Each event slot accepts multiple clips — one is selected at random each time that event fires.
Dedicated Audio Sources
Property
Description
Fire Source
Uses PlayOneShot to allow rapid overlapping muzzle blasts without terminating the previous blast.
Reload Source
Uses standard playback for the mechanical winding loop, allowing it to fade out smoothly. Also plays the final mechanical "Loaded" click.
Loaded Source
Dedicated to looping tension sounds (e.g., creaking ropes, strained wood) while the weapon sits armed. Automatically stops when the weapon fires or breaks.
Break Source
Plays the destruction sounds using a frame-accordion system to prevent clipping and audio blow-out when multiple weapons shatter simultaneously.
Audio Clips
Clip Array
When It Plays
Fire Sounds
At the start of the Firing state, before the projectile spawns.
Reload Sounds
When the Reloading state begins, cleanly cutting off any lingering operational loops.
Loaded Sounds
When the weapon transitions into the Loaded state (winding click, chain lock, etc.).
Break Sounds
On weapon destruction. Uses the same frame-accordion system as Interactive Props: if multiple weapons break on the same frame, later ones are played at reduced volume to prevent audio clipping.
The Dual-Layer Audio Paradigm: Projectiles vs. Surface Materials
To protect runtime memory and eliminate channel masking conflicts, weapon impacts are split away from the chassis:
Core Kinetic Mass Thuds are populated within the impactSounds array inside the core projectile scripts, spawning out in world space exactly where the strike occurs.
Contextual Surface Splintering (e.g., stone fracturing, dirt dispersion, timber cracking) is offloaded to the DPT_ProjectileSurfaceImpact component based on targeting physics layers.
Audio Settings
Property
Description
Pitch Variance
Each sound is played at a pitch offset randomly sampled from ±this value. At 0.15 (the default), pitch varies between 0.85× and 1.15×, preventing identical sounds from feeling mechanical.
VFX
Property
Description
Fuse Effect
A ParticleSystem representing the burning fuse, typically parented under Fuse Point. Played when the weapon enters the Loaded state and stopped (with Clear()) when the weapon fires, is destroyed, or is reset. Play On Awake should be disabled on the assigned ParticleSystem as the script manages playback directly.
Fire VFX
A particle system prefab instantiated at the Launch Point when the projectile spawns (20% into Fire Duration). Use this for muzzle flash, dust kick, or similar one-shot fire effects. Automatically destroyed after 5 seconds.
Reload VFX
A particle system prefab instantiated at the weapon root when the reload sequence completes. Automatically destroyed after 5 seconds.
Particle Destroy VFX
A particle system prefab instantiated at the weapon position when it is destroyed. Automatically cleaned up after timeBeforeCleanup seconds.
Fuse Point setup: Create an empty child GameObject on the cannon prefab and position it at the touch-hole, then assign it to **Fuse Point**. Parent both your animated spark mesh and your fuse ParticleSystem under this GameObject. The script toggles the entire Fuse Point active state, so the spark mesh, particle emitter, and any fuse smoke all activate and deactivate together with one call — no animation keying required. The spark mesh itself can rotate and pulse continuously via a simple script or Animation component while the GameObject is active.
Unity Events & Animator Integration
Every stage of the weapon loop exposes a UnityEvent in the Inspector. The primary use case is wiring these directly to Animator.SetTrigger() calls — no intermediate scripts required.
Recommended Animator Wiring
UnityEvent
Recommended Animator Call
Notes
onFireEvent
Animator.SetTrigger("Fire")
Fires at the start of the Firing state, before the projectile spawns.
onProjectileLaunchEvent
Camera shake / launch VFX trigger
Fires at the moment the projectile is instantiated, 20% into Fire Duration.
onReloadStartEvent
Animator.SetTrigger("Reload")
Fires at the start of Reloading.
onReloadCompleteEvent
Animator.SetTrigger("Loaded")
Fires when reload finishes and the weapon is armed again.
onLoadedEvent
Animator.SetBool("Loaded", true)
Also fires at startup if Start Loaded is enabled.
onMoveStartEvent
Animator.SetBool("Moving", true)
Fires once when movement begins. Pairs with separate wheel rolling animation parameters.
onMoveStopEvent
Animator.SetBool("Moving", false)
Fires once when StopMoving() is called.
onDestroyedEvent
Animator.SetTrigger("Destroy")
Fires before debris physics begin — wire any death animation trigger here.
The following public methods are safe to call from any external script, NavMeshAgent, or AI controller.
Weapon Control
Method / Property
Description
Fire()
Begins the fire sequence. Only executes if the weapon is currently in the Loaded state.
Reload()
Begins the reload sequence. Has no effect if the weapon is already Loaded or Destroyed.
Traverse(float degrees)
Rotates the traverse pivot by degrees × traverseSpeed × Time.deltaTime per frame. Pass a normalised axis value (−1 to 1) from your input system.
Elevate(float degrees)
Pitches the elevation pivot. Same delta convention as Traverse.
AimAt(Vector3 worldPos)
Instantly solves and applies the traverse and elevation angles needed to face a world-space point. For weapons without an elevation pivot, the ballistic solver adjusts launchSpeed to reach the target, clamped to minLaunchSpeed and maxLaunchSpeed. Suitable for AI targeting.
StopAiming()
Marks aiming as complete and fires onAimStopEvent.
Move(Vector3 worldDelta)
Translates the whole weapon position by worldDelta × moveSpeed × Time.deltaTime. Fires onMoveStartEvent on the first call after being stopped.
StopMoving()
Fires onMoveStopEvent and returns the weapon to Idle or Loaded.
AdjustLaunchSpeed(float delta)
Adds delta to the current launch speed and clamps the result between minLaunchSpeed and maxLaunchSpeed. This is the correct method to call from a player controller when adjusting power — the weapon owns its own clamping logic and no external limits are needed.
Damage & Destruction
Method
Description
TakeDamage(float amount, Vector3 hitPoint)
Reduces health by amount. Triggers destruction if health reaches zero. hitPoint is used to bias the debris explosion direction.
DestroyWeapon()
Destroys the weapon immediately with a non-directional explosion.
DestroyWeapon(Vector3 hitPoint)
Destroys the weapon with a directional explosion originating from hitPoint.
ResetWeapon()
Fully restores the weapon to its initial state: health, position, Rigidbody poses, pristine meshes, fuse state, satellite component fields, and state machine. Safe to call for object pooling.
Read-Only State Properties
Property
Description
WeaponState State
The current WeaponState enum value. Poll this from an external Animator driver or UI health system.
float HealthNormalised
Current health as a 0–1 value. Suitable for driving a health bar slider directly.
bool CanFire
Returns true only when the weapon is in the Loaded state.
Example: AI Fire Controller
// Fire at the player when within range and weapon is ready
void Update()
{
if (!weapon.CanFire) return;
float dist = Vector3.Distance(transform.position, player.position);
if (dist < attackRange)
{
weapon.AimAt(player.position);
weapon.Fire();
}
}
Example: Adjusting Launch Power from a Custom Controller
// Call AdjustLaunchSpeed rather than setting launchSpeed directly.
// The weapon enforces its own min/max clamp internally.
void Update()
{
float mouseY = Input.GetAxis("Mouse Y");
weapon.AdjustLaunchSpeed(mouseY * powerAdjustmentSpeed * Time.deltaTime);
}
Scene View Gizmos
Select any GameObject carrying a DPT_SiegeWeapon component to see the following gizmos:
Gizmo
Colour
Description
Explosion Origin
Red dot
The world position from which the internal fracture explosion originates, offset by Explosion Y Offset.
Shatter Radius
Red disc
The inner explosion radius. Debris within this disc receives maximum force.
Force Scale Ring
Orange disc
The outer ring showing approximate force reach, scaled by Explosion Force and Directional Impact Force.
Kinetic Transfer
Blue sphere
The radius within which nearby Rigidbodies will be pushed on destruction. Only shown when Transfer Kinetic Energy is enabled.
Traverse Arc
Green arc
The permitted horizontal rotation range. Only shown when a Traverse Pivot is assigned.
Launch Direction
Yellow ray
A ray from the Launch Point showing the projectile launch direction, scaled by Launch Speed. Only shown when a Launch Point is assigned.
Editor Testing Tools
The DPT_SiegeWeaponEditor toolbar appears at the top of the Inspector whenever a Siege Weapon is selected. All buttons work in both Edit Mode and Play Mode.
Button
Description
Destroy Weapon
Calls DestroyWeapon() and runs 2.5 seconds of script-mode physics simulation so debris scatters visibly in the Scene view without entering Play Mode.
Fire Weapon
Calls Fire(). Useful for testing event wiring and projectile spawn without Play Mode.
Reset Weapon
Calls ResetWeapon() and marks the object dirty for serialisation. Use this to undo a test destruction in the Scene.
Reload
Calls Reload() to manually step the weapon back to its Loaded state.
Take Damage (50)
Applies 50 points of damage at the weapon's position. Useful for verifying health thresholds and testing partial-health behaviour.
Automatic Scene Reset on Play:
DPT_SiegeWeaponEditor hooks into EditorApplication.playModeStateChanged. Every time you enter Play Mode, all DPT_SiegeWeapon instances in the scene — including inactive ones — are automatically reset to their initial state. This prevents debris from accidentally carrying over from an Edit Mode test into a Play Mode run.
DPT_SiegeWeaponController — Demo Player Controller
DPT_SiegeWeaponController is a ready-to-use first-person controller that lets a player walk up to any siege weapon, press E to take control of it, aim and fire, then press E again to disengage. It is included as a functional starting point and demonstration of the DPT_SiegeWeapon API — you are expected to replace or extend it for your own project.
This is a demo script. It drives the weapon entirely through the public API (Traverse(), Elevate(), Fire(), AdjustLaunchSpeed()) and contains no weapon logic of its own. Swap it for your own controller at any time without modifying DPT_SiegeWeapon.
Inspector Fields
The controller natively utilizes the modern Unity Input System via InputActionReference variables, completely decoupling the package from hardcoded keys. You must map your action asset into the corresponding inspector slots and ensure a PlayerInput component is active in your scene to drive the inputs.
Property
Description
Input Actions
The required action maps for Interact, Move (Vector2), Look (Vector2), Fire, Reload, Zoom, Toggle Auto-Reload, and Toggle Auto-Fire.
Player Camera
The camera used for the possession raycast and for snapping to the weapon seat on possession. Defaults to Camera.main if left unassigned.
Interaction Distance
Maximum range (m) at which the player can look at and possess a weapon. Default: 5 m.
Allow Chassis Movement
If enabled, the movement vector moves the entire weapon chassis (for wheeled weapons).
Chassis Rotation Speed
Degrees per second the chassis rotates on horizontal input, for weapons without a traverse pivot. Default: 45°/s.
Mouse Sensitivity
Multiplier applied to look delta before it is passed to Traverse() and Elevate().
Power Adjustment Speed
Scales how fast vertical look movement changes launch power on fixed-angle weapons (those without an elevation pivot). Weapon speed limits are enforced by minLaunchSpeed and maxLaunchSpeed on the weapon itself.
Zoomed FOV
Target Field of View applied to the camera while the Zoom action is held.
Zoom Speed
How fast the camera transitions between the default FOV and the Zoomed FOV.
Camera Interface Integration (IControllableCamera)
To cleanly decouple the siege weapon framework from your specific character controller, the possession system relies on the IControllableCamera interface. Simply add this interface to your custom player camera script (e.g., public class MyCharacter : MonoBehaviour, IControllableCamera) and implement the SetEnabled(bool state) method to freeze your character's movement. The siege weapon will automatically find it and manage the transition without slow reflection queries.
Camera & Screen Shake Modules
To add visceral impact to your siege weapons, the package includes modular screen shake components. These are completely decoupled from the main weapon controller, relying on the public UnityEvents to trigger.
Weapon Fire Screen Shake
The DPT_WeaponFireScreenShake component listens to the weapon's onProjectileLaunchEvent to trigger an environmental camera shake whenever the weapon fires.
Property
Description
Shake Magnitude
The raw intensity/distance of the camera displacement.
Shake Duration
How long the shake effect lasts in seconds.
Shake Radius
The maximum distance from the weapon that the shake can be felt. The intensity falls off linearly towards the edge of this radius.
Is Possessed
If true, the environmental shake is muted. Toggle this via your player controller possession logic so the player doesn't experience extreme screen shake when they are the one operating the weapon.
Camera Shake Receiver
For the shake to actually move the player's view, attach the DPT_CameraShakeReceiver component directly to your Player Camera. This singleton-style listener automatically subscribes to both weapon firing events (DPT_WeaponFireScreenShake) and projectile impact events (DPT_ProjectileScreenShake), calculates distance attenuation, and applies the local position offset.
Seamless Integration: Both the weapon and projectile shake modules broadcast a static event containing their epicenter and shake parameters. The Receiver handles the rest, ensuring that overlapping shakes smoothly override each other based on intensity and remaining duration.
Breakable Props (DPT_BreakableProp)
The DPT_BreakableProp component is a streamlined script designed specifically for static destructible objects like mantlets, barricades, and ammo crates. It utilizes the same fracture physics, manual audio assignment, and automatic cleanup routines as the main Siege Weapon controller, but strips out all aiming and firing state machines for maximum performance on simple props.
Quick Setup
Attach the DPT_BreakableProp script to the root of your prop prefab. Make sure the root object has a Collider.
Assign your intact meshes to Pristine Meshes and your broken debris root to Broken Parents.
Under Audio & VFX, manually assign an AudioSource (configured for 3D spatial blending) and populate the Break Sounds array.
Adjust Max Health, Explosion Force, and Time Before Cleanup to suit the material of the prop.
Inspector Reference
Visuals, Health & Damage
Property
Description
Pristine Meshes / Broken Parents
Pristine meshes are hidden on break, and broken parents are activated to simulate fracture.
Max Health
Structural health of the prop. Reaching 0 triggers the destruction sequence.
Break On Impact
If enabled, physical collisions exceeding the Impact Velocity Threshold will apply damage automatically based on relative velocity.
Simulated Ramming Speed
Simulated speed (m/s) applied when a kinematic vehicle (like a driven ballista) rams this prop.
Push Non Prop Objects
If true, applies an explosion force to ALL nearby rigidbodies on break, not just siege props.
Offensive Capabilities
Property
Description
Apply Damage On Contact
If true, this prop deals damage to other breakable objects or siege weapons it hits.
Contact Damage
Damage dealt to other objects on impact.
Destruction Physics & Broken Base
Property
Description
Explosion Force / Radius
The radial impulse applied to all debris pieces upon destruction.
Explosion Y Offset
Vertical offset for the internal explosion origin.
Momentum Transfer
How much of the incoming object's velocity is transferred to the flying debris.
Broken Base Pieces
Debris rigidbodies treated as structural 'base' pieces. They receive reduced explosion force and remain in place when the prop breaks.
Base Force Multiplier
Force multiplier applied only to base/structural pieces.
Time Before Cleanup / Sink Speed
How long the debris remains in the scene before freezing physics and sinking cleanly into the ground.
Destroy On Cleanup
If true, the GameObject is fully destroyed after sinking. If false, it is deactivated.
Audio, VFX & Events
Property
Description
Audio Source
The AudioSource component used to play the break and contact sounds.
Particle Destroy VFX
Particle VFX instantiated at the prop position on destruction.
Break Sounds
Sounds played when the prop is destroyed.
Contact Sounds
Sounds played when this prop deals contact damage to another object.
Always Play Contact Sound
If true, contact sound plays on every collision. If false, it only plays when damage is dealt to a valid target.
Pitch Variance
Random pitch fluctuation applied to audio playback (0 to 0.5).
onDamagedEvent
Fired whenever the prop takes damage.
onDestroyedEvent
Fired when the prop reaches 0 health and breaks.
Scripting API
Interfacing with the Breakable Prop from your custom projectile or player scripts is straightforward:
Reduces health. If health reaches 0, the prop shatters, with the explosion centered near the hitPoint. hitDirection transfers momentum to debris pieces.
DestroyProp()
Bypasses health and shatters the prop immediately from its center, accounting for the explosionYOffset.
Compatibility & Integration
Shared Infrastructure with Interactive Props
The destruction pipeline in DPT_SiegeWeapon is a direct port of the one used in DPT_InteractiveProp. Both systems use identical fracture force application, kinetic transfer, debris cleanup, and audio accordion logic. A weapon placed alongside interactive props in the same scene will behave consistently — debris forces, cleanup timing, and audio ducting all follow the same rules.
Input System Compatibility
DPT_SiegeWeaponController compiles correctly against the legacy UnityEngine.Input API and the new UnityEngine.InputSystem package. The correct path is selected automatically at compile time via #if ENABLE_INPUT_SYSTEM. In production, disable enableDirectInput and drive the weapon API from your own controller.
Object Pooling (Safe Debris Recall)
ResetWeapon() is strictly pool-safe. It restores all mesh visibility, Rigidbody poses, collider states, health, angle offsets, fuse state, satellite arrays, and the state machine. Crucially, the base class automatically caches the original local hierarchy data of every shattered piece. When reset, the weapon instantly vacuums up its unparented debris fragments, snaps them back to their original zero coordinates, and freezes their physics. Set Destroy On Cleanup to false to deactivate rather than destroy the GameObject at the end of its cleanup routine.
Support & Custom Pipeline Integration
If your project requires external or custom 3D models to be fully integrated into the DPT ecosystem—including custom vertex-data packing, procedural wood grain mapping, normal array configuration, advanced GPU wind system implementation, or any other bespoke features—freelance technical art services are available. Additionally, availability extends to general 3D asset production, high-to-low poly hard surface modeling, stylized prop creation, and game-ready LOD budgeting built to align cleanly with your specific project constraints.
Contact & Inquiries:
For freelance modeling contracts, custom asset optimization passes, standard package bug reports, and publisher licensing enquiries, please use the Contact Form on the DPT Games Hub.
DPT Support Discord:
For dedicated technical assistance, asset configuration help, and direct feedback on our Unity packages, join the Support Server.