Skip to content

fix: sparks, smoke and spell particles fall and drift in the world - held and followed effects stay with their emitter - #579

Open
BoroBongo wants to merge 4 commits into
developfrom
fix/pfx-world-space
Open

BoroBongo wants to merge 4 commits into
developfrom
fix/pfx-world-space

Conversation

@BoroBongo

Copy link
Copy Markdown
Contributor

What

Particles now live in the world once they are emitted, like in the engine. Sparks, smoke and spell particles fall and drift instead of moving and turning with their emitter. flyGravity always pulls down: in the emitter's frame, a turned emitter pulled its particles sideways. The grindstone's sparks, for example, made a horizontal line instead of a falling shower. The velocity directions (dirFor OBJECT, TARGET) are converted into the world at build time.

Effects that must follow their emitter keep simulating in it. A new optional isFollowingEmitter on MeshService.CreateVobPfx covers:

  • VR held spells: the ring and slot glow, and the hand charge;
  • the NPC mage's hand glow;
  • effects on a followed object: sleep over the head, spell hits, Wld_PlayEffect, effects while investing a spell;
  • the light spell on the hero.

These stay in the world and trail behind their emitter:

  • the torch flame (when swung);
  • projectiles;
  • an NPC's bone-chain fire;
  • world VOB effects.

Why

Playtest (G2 Khorinis smithy, with the mob animations of #578): the grindstone sparks streaked sideways in a line. The author saw the same with spells. Switching every system to world space live in the editor made them fall correctly.

How to test manually

  • G2 Khorinis smithy: the grindstone sparks fall, and the anvil sparks spread around (with feat: mobs play their own animations, sounds and particles while they are used - the smithy rings, sparks and steams #578).
  • VR: a spell held in the ring or a slot glows in the hand without leaving a streak. The hand charge stays in the hand.
  • An NPC mage draws a spell: the glow stays in his hand.
  • Sleep spell on an NPC (effect over the head), spell hits and the light spell while walking: they follow.
  • Swing a torch: the flame trails, and its direction looks right. Note: a DIR effect keeps the direction it was built with.
  • Projectiles leave trails.
  • A mover or lift with a particle effect: check it doesn't smear badly.

Save/load

Nothing.

Known gaps / follow-ups

🤖 Generated with Claude Code

BoroBongo and others added 4 commits November 25, 2026 23:16
…they no longer move or turn with their emitter

Particles simulated in the emitter's space unless dirFor was WORLD, and flyGravity was applied in that space too.
A turned emitter (the grindstone's wheel, a spell in the hand) pulled its particles sideways into a line instead of
a falling shower. Like the engine, an emitted particle now lives in the world and gravity points down; dirFor/shpFor
still give the frame a particle starts in. Tried live in the editor (G2 Khorinis smithy): the grindstone sparks fall.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…nd instead of smearing into a streak

PrepareHeldEffect only set Local simulation for Gothic's own motion; the ring's and the slot's standing glow relied on
the builder's old default (Local). The builder now simulates in World, so that glow was left behind in the world when
the hand moved. Both modes simulate in the hand's space now.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… on an NPC move with him instead of trailing

Since particles live in the world, effects stuck to a moving body were left behind: a mage's hand glow streaked
behind his arm, the sleep effect over the head and hit effects on an NPC trailed when he walked, the light spell's
glow trailed behind the hero. CreateVobPfx(isFollowingEmitter) builds them in the emitter's space again (also their
sub-emitters). The VR hand charge and the ring/slot effects pass it too. A swung torch flame and flying spells stay in
the world (they trail like in Gothic).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…tion is taken into the world once, when built

With World simulation Unity turns a Local velocity over lifetime with the emitter's current rotation every frame, so a
turning emitter (the grindstone) still curved particles that were already flying (dirMode DIR with dirFor OBJECT, and
TARGET). The direction is now converted with the emitter's rotation at creation and the velocity module is World;
dirFor still says in which frame a particle starts. The root is placed before that, so the rotation is the final one.
Limitation (comment): an emitter that turns after it was built keeps its first direction. Effects that follow their
emitter keep the Local velocity, turning with it like before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@BoroBongo

Copy link
Copy Markdown
Contributor Author

Review (architecture-reviewer + gothic-reviewer)

Architecture: fits. Gothic: fix before merge. Fixed:

  • fix Pico SDK #1 (High). The VR ring and slot glow relied on the builder's old Local default and would have smeared. PrepareHeldEffect now sets Local for both branches.
  • feature/NPC-walking-fixes #2 (Medium). Effects that follow their emitter (NPC hand glow, followed effects, the VR hand charge, the light spell) are built with isFollowingEmitter and simulate Local. The call-site list is in the second commit.
  • bugfix/spawn-points #3 (Medium). A Local velocity under World simulation curved the particles of a turning emitter. The velocity is now World space, rotated by the emitter's rotation at build time (Local only for following effects).

Follow-up: #576 (remove the call sites that repeat the World default).

Check:

  • Gothic.Core compiles (offline build). The VR assembly is checked by Unity on import.
  • Tried live by switching every particle system to World in the editor: the grindstone sparks fell. The author confirmed it.
  • The final version (with feature/NPC-walking-fixes #2/bugfix/spawn-points #3) is not yet run in play.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant