Jump to content

Particle


hunts
 Share

Recommended Posts

Hi hunts.  Nice scene! 

For never-ending terrain, not easy to cover all with particle snows.  You can think about making plane for emitter and parenting to camera, but... if you move camera quickly, particles that have ALREADY BEEN EMITTED... don't move with cam.  Looks goofy.

http://www.babylonjs-playground.com/#FJNR5#54

(mousewheel or control-drag out-of snowstorm - not good)

This PG uses top - a basic BJS plane, as emitter.  It is not parented, but the plane is continuously positioned in a renderLoop thing (lines 104-107).  This PG uses an arcRotate cam, temporarily (it helped me see the size and shape of particleSystem emitBox min/max.)

Sorry for changing texture... I was bored while I was thinking of ways to do this.  :)  Still no success. 

We actually need to transform the verts of all in-flight rendered particles == camera orientation... all the time (or similar). 

When the camera positions or rotates, so must ALL particles (as a group, not each individually).  The emitter plane must orient, too, but we already have that... with parenting 'top' (the emitter plane) to camera.

Anyway, here is another arcCam version, where we can see the emitter plane [called top] out in front of us.  It is not parented to cam, yet.  I have added all 3 customizable particleSystem funcs... to this particleSystem, and activated them.  But I think my_updateFunction is where the modification must happen(we can likely remove the other 2 custom particleSystem funcs, later)

Hey hunts... notice the indenting clean-up in v55.  Try to keep it that way, huh?  ;)  (easier for forum helpers to help, when code is indented nice)

Restating the issue:  When particle emitter plane (named top) is parented to cam and its position nulled to 0,0,0 (lines 56-57 area), you can navigate the camera OUT OF the snowstorm... by moving cam forward/backward (mousewheel), or sideways (control-drag). 

The emitter can be parented to the cam, so it is ALWAYS above the camera, like a roof, BUT... particles that have already been emitted... will not move WITH the camera.  Moving the emitter does NOT move already-emitted particles.

I think we need a modification... just after line 133:

133. particle.position.addInPlace(this._scaledDirection);
insert 134.  particle.position.calculateAdjustedPositionBasedUpon(camera.positionChangeSinceLastMove);  hehe.  Something like that.

Let's pretend all particles... are actually a PART of ONE mesh.  IF we could move THAT mesh... when the camera moved, then all particles that were already emitted... might move too. 

THAT is what we want.  Currently, we can only move the emitter with the camera (after we set top.parent = camera, currently NOT set)... but parenting ONLY moves the emitter.  Particles that are already flying... don't move with the cam/emitter.  hmm. 

Sorry for long-talking.  Help needed.  Anyone got an idea about this?  Forum helpers, remember... infinite terrain.  This will require a snowstorm that moves WITH the cam.  :)  Thx for help/advice. 

Sorry for no solution yet, hunts.  Be patient... smarter people than I... are nearby.

Core Gods:  .showBoundingBox might have problems.  TypeError: t is undefined - babylon.js:23:17281  (thx)  Activate line 55 in demo #56... to see issue/console error.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...