WeaponView class final

The weapon in the player's hands, and everything that makes it feel held.

Its own scene and its own camera, drawn by the renderer's view-model pass after the world and with the depth buffer cleared. A weapon is a few centimetres from the eye, and in the world's depth buffer it would be buried by the first wall the player walked up to.

The narrow field of view is not a detail either. The world camera is wide enough to take in a room; a model rendered at that angle this close has its edges stretched into something that reads as a bug.

What the weapons look like is not here. The game hands in one node per weapon name; this owns the rig around them — the scene, the camera, the lighting, the holder, the bob and the recoil.

Constructors

WeaponView({required Map<String, SceneNode> models, WeaponDef? initial, TextureHandle? environment, int environmentLevels = 0})
models is one root node per WeaponDef.name. Each is parented to the holder and hidden; initial is the one shown first.

Properties

hashCode → int
The hash code for this object.
no setterinherited
plugin → ViewModelNode
The plugin that draws the weapon over the finished scene.
latefinal
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
recoil() → void
Kicks the weapon back. Called when a shot actually happened, not when the trigger was pulled — a dry click should not recoil.
selectWeapon(WeaponDef weapon) → void
Shows weapon's model and hides the rest.
step(double dt, {required double speed, required bool grounded}) → void
Advances the bob and the recoil by one simulation step.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited