Cannon
A muzzle-loading cannon on its carriage: a ship's gun on a low four-truck carriage, or a field gun on two big spoked wheels with a trail. The muzzle points +Z; the barrel is a part named barrel that pivots on its trunnions about x (elevation), and the wheels roll with distance travelled. Default barrel is 2 m long.
- Size
- 2.1 × 1.0 × 2.5 m
- Triangles
- 1,364
- Kit
- Pirates
Tune it
5 knobs: Carriage, Barrel, Elevation, Size, Shot and tools.
Specs
- Size
- 2.1 × 1.0 × 2.5 m width × height × depth
- Triangles
- 1,364 of 6,000
- Draw calls
- 1 one vertex-colour material
- Loop clip
- 1.257 m of travel per cycle
- Moving parts
- 5 barrel · rotate, wheel_0 · spin, wheel_1 · spin, wheel_2 · spin, wheel_3 · spin
- Knobs
- 5 3 presets
- Night lights
- 0 none
Passed the validator: real scale, rests on y = 0, front faces +Z, deterministic.
Use it
Code for the specimen as it is set up above; it follows your knobs.
import { createAsset } from 'https://gaitkit.com/cdn/cannon.mjs';
const cannon = createAsset();
scene.add(cannon); // rests on y = 0, front faces +Z
let dist = 0;
renderer.setAnimationLoop(() => {
dist += speed * clock.getDelta();
cannon.position.z = dist;
cannon.userData.tick(dist); // wheels roll exactly with the distance
renderer.render(scene, camera);
});import { useMemo, useRef } from 'react';
import { useFrame } from '@react-three/fiber';
import { createAsset } from 'https://gaitkit.com/cdn/cannon.mjs';
export function Cannon({ speed = 1 }) {
const model = useMemo(() => createAsset(), []);
const dist = useRef(0);
useFrame((_, dt) => {
dist.current += speed * dt;
model.position.z = dist.current;
model.userData.tick(dist.current); // wheels roll exactly with the distance
});
return <primitive object={model} />;
}# Import cannon.glb (download below). It carries an in-place "Loop" animation.
@onready var anim: AnimationPlayer = $Cannon/AnimationPlayer
func _physics_process(delta):
velocity = transform.basis.z * speed
move_and_slide()
anim.play("Loop")
anim.speed_scale = speed / 1.257 # one Loop = 1.257 m of travel// Import cannon.glb with glTFast (com.unity.cloud.gltfast).
animator.Play("Loop");
animator.speed = speed / 1.257 // one Loop = 1.257 m of travelUse the gaitkit MCP server: get_variant({ "id": "cannon", "want": "default look" })
then place the result and drive it with userData.tick(distance).
# MCP endpoint
https://gaitkit.com/mcpKnobs
| Knob | Type | Values | Default | What it does |
|---|---|---|---|---|
carriage | choice | naval field | naval | naval (low red-ochre ship's carriage on four small wooden trucks, for gun decks and forts) or field (two tall spoked wheels and a long trail resting on the ground, for land batteries). |
barrel | choice | iron bronze verdigris | iron | Barrel metal: iron (dark grey-black), bronze (warm gold-brown) or verdigris (old bronze gone sea-green). |
elevation | range | -5 to 12, step 1 | 3 | Barrel elevation in degrees, positive raises the muzzle. Same as rotating the barrel part about x; the wooden quoin under the breech follows. |
size | range | 0.6 to 1.5, step 0.05 | 1 | Overall scale. 1 is a 12-pounder with a 2 m barrel; 0.6 a light 4-pounder; 1.5 a heavy 32-pounder. |
shot | toggle | on / off | true | A pyramid of cannonballs, a powder keg and a rammer laid beside the gun. |
Presets: gun deck {"carriage":"naval","barrel":"iron","elevation":0} · fort battery {"carriage":"field","barrel":"bronze","elevation":10,"size":1.2} · sunken relic {"carriage":"naval","barrel":"verdigris","shot":false,"elevation":-3}
Files
| File | What |
|---|---|
| cannon.glb | GLB, default look · 172 KB |
| cannon.mjs | ES module, every knob live |
| cannon.obj | OBJ, static, no colour |
| cannon-params.json | knob schema, presets, night zones |
Licence
Use it in games, apps, renders and client work, commercially and without credit. Do not resell it as an asset or train a 3D generator on it. The full licence.