Jump to content

Emit particles in local space rather than world space?


testure
 Share

Recommended Posts

The minEmitBox and maxEmitBox define a box around the current position of the emitter. They are defined in object space NOT world space

Same thing for direction1 and direction2.

 

if you want to work in world space just replace startDirectionFunction and startPositionFunction. Here are the default implementation:

this.startDirectionFunction = (emitPower: number, worldMatrix: Matrix, directionToUpdate: Vector3): void => {                var randX = randomNumber(this.direction1.x, this.direction2.x);                var randY = randomNumber(this.direction1.y, this.direction2.y);                var randZ = randomNumber(this.direction1.z, this.direction2.z);                BABYLON.Vector3.TransformNormalFromFloatsToRef(randX * emitPower, randY * emitPower, randZ * emitPower, worldMatrix, directionToUpdate);            }            this.startPositionFunction = (worldMatrix: Matrix, positionToUpdate: Vector3): void => {                var randX = randomNumber(this.minEmitBox.x, this.maxEmitBox.x);                var randY = randomNumber(this.minEmitBox.y, this.maxEmitBox.y);                var randZ = randomNumber(this.minEmitBox.z, this.maxEmitBox.z);                BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate);            }
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...