18
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-12-03 12:25:27 +01:00
Commit Graph

5 Commits

Author SHA1 Message Date
maj00r 13ea1c7808 fix(vehicle): hoses clamped in their cocks, the coupling head held whole
At a wide swing to the side the coupled heads seemed to come apart:
- The chain hung on pins at its ends and swung about the line between the cocks like a pendulum, over 30 cm to the
  side. The rigid head then turned far against the rubber.
- Since the hose is halved into small triangles, part of each head's vertices lay nearest the last but one piece of
  the spine. Those followed the rubber, not the head, and the head bent apart.

Now:
- An end of a chain at a fixed or coupler point is clamped: the node next to it is drawn to where it is as made, held
  to that vehicle (for a coupler point, to the next one). The hose leaves its cock as made. In a unit test a hose swung
  40 degrees to the side goes 1.8 cm to the side clamped, where it went 13.2 cm on pins.
- All of a coupling head within 8 cm of where the heads meet is held to the head as one, whichever piece it lies
  nearest.
- Measured in a drive of two EU07, the centres of the two heads keep 55.9 mm apart (their place side by side in the
  coupling) with no change at all over 784 frames.

Assets: none.
2026-11-25 11:12:59 +01:00
maj00r 8f840949e8 test(vehicle): the bone tests count their loops in whole steps (Sonar S2193)
Assets: none.
2026-11-25 10:04:50 +01:00
maj00r 352d75a745 fix(vehicle): coupled hoses one chain for both vehicles, no jolts from the frame time
Driving on uneven track, the hoses between two coupled vehicles flew up and the coupled heads came apart:
- The chain started at rest under a vehicle already running, and was left behind by it: the head flew 1 m up.
- A frame longer than 0.1 s was cut short while the ends moved all the way, a jolt against the vehicle.
- The substeps change their length from frame to frame, and the move of the last one was taken as it was: a jolt
  of some centimetres a substep at 50 km/h (12.8 cm of swing in the new unit test, under 5 mm now).
- Each of the two vehicles moved its own copy of the hose; started apart or jolted, the copies drifted up to 25 cm.

Now a chain starts going along with its ends, the move of the last substep is scaled to the next one, the chains
move by the whole frame time and start again after a gap of more than 0.5 s, and a hose from cock to cock is moved
by one of the two coupled vehicles, the other drawing the same chain from its end. Measured on two EU07 at 50 km/h
on uneven track: the heads of the two vehicles 0.0 mm apart, the head within 0.40..0.67 m of height (it was
0.38..1.55 m).

Assets: none.
2026-11-25 09:41:34 +01:00
maj00r 35b70ce8d5 feat(vehicle): hoses bent along their chain, coupled head to head and swinging with inertia
A new .mmd entry, bonebend, bends a submodel made in one piece (the hoses of the existing models, pneumatic*) along
a spine of points: each vertex follows the nearest piece of the spine, the turn carried along it from the cock so
the rubber twists evenly. With head, the coupling head is held as one to the line between two points and the
vertical of the world, so the heads of two coupled hoses stay together on one plane. The vertices are bent on the
CPU into the vehicle's own copy of the submodel, drawn in its place.

The chains (bonechain) now:
- keep every other node at its distance as made, so a hose keeps its curve rather than folding;
- damp only the swing against the vehicle, so a hose goes along with the vehicle's own motion;
- average what the lengths ask of each node: the plain sum overshot, and a chain shivered and stretched by a fifth;
- take up to 64 nodes, enough for one chain from a cock to the cock of the next vehicle with the head node
  between: both vehicles get the same chain, and the coupled heads lag and swing with the hoses;
- move once a frame, by the render time, not once a render pass.

Assets: none needed. A vehicle without bonebend lines in its .mmd is drawn as before; bones_doc.md has the entries
for an EU07 hose. Tried on a local test copy of the EU07 (dynamic/test/4e_kosci, not in the SVN), not on a vehicle
of the SVN yet.
2026-11-25 02:40:05 +01:00
maj00r 5e00999cb8 feat(vehicle): bones of the vehicle models: the rods of a steam locomotive, couplers and hanging hoses
A vehicle's .mmd can pin submodels of its model to points that move and turn them to keep facing another point
(vehicle/bones.h, TDynamicObject::update_bones(), run with the wheels):

- bonepoint: fixed, crank (going round with a wheel submodel of animwheelprefix:), slide (a crosshead on its
  guide keeping the length of the connecting rod), coupler (the next vehicle's hook, following it round a curve,
  over uneven track and with the buffers pressed in), mid (halfway between two points);
- bonechain: a chain hanging between two points, its nodes swinging with gravity and inertia (Verlet
  integration in the world frame, substeps of 1/240 s at most), so a hose made of pieces swings when the vehicle
  jerks or rocks and sags as the buffers close up;
- bone: a submodel moved with its anchor point and turned about it to face another point, or only moved.

The submodels are posed with TSubModel::SetTranslate() and SetRotateXYZ(), in their own frame whatever their
origin and axes, and get their future_transform for the motion blur. A model without these entries is drawn as
before; the old entries animpistonprefix:, animconrodprefix:, animreturnprefix: and pistonfactors: still do
nothing. bones_doc.md describes them, with examples.

Unit tests (tests/unit/test_bones.cpp): the crank and the crosshead (the stroke twice the crank), the connecting
rod keeping both its ends for a submodel turned in its frame, the angles giving what TSubModel::RaAnimation()
does, the coupler, the hose meeting point, a chain hanging and swinging after a jerk, and the .mmd errors.

Game data: the placeholder Ty2 of dynamic/pkp/ty2_v1 (SVN working copy, not committed) has its rods and its brake
hose to the tender as bones in ty2.mmd. The EU07 (dynamic/pkp/4e_v1/4e.mmd) could take the six coupler lines of
bones_doc.md, which were tried on a copy in a test folder; the data in the SVN isn't changed.
2026-11-24 21:57:23 +01:00