Skip to content

Commit

Permalink
Fixed|Particles: Particle spawn position affected by source float bob…
Browse files Browse the repository at this point in the history
…bing

When particles are spawned, in addition to floorclip, float-bobbing
is also taken into account.

Todo for later: It would be useful to have a generator flag that
determines that bobbing should be applied at a later stage, e.g.,
during rendering. This would allow for particles that appear
inside an object to stay inside it. In practice, it would be enough
to store the “bobbing phase” of the particle and have the renderer
figure out the offset based on that and time.

IssueID #932
  • Loading branch information
skyjake committed Dec 23, 2013
1 parent 4ce0669 commit 9408252
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions doomsday/client/src/world/p_particle.cpp
Expand Up @@ -582,6 +582,9 @@ static void P_NewParticle(ptcgen_t *gen)
// Offset to the real center.
pt->origin[VZ] += gen->center[VZ];

// Include bobbing in the spawn height.
pt->origin[VZ] -= FLT2FIX(Mobj_BobOffset(gen->source));

// Calculate XY center with mobj angle.
ang = Mobj_AngleSmoothed(gen->source) + (fixed_t) (FIX2FLT(gen->center[VY]) / 180.0f * ANG180);
ang2 = (ang + ANG90) >> ANGLETOFINESHIFT;
Expand Down

0 comments on commit 9408252

Please sign in to comment.