testure Posted August 2, 2014 Share Posted August 2, 2014 Most engines allow you to emit particles in either local or world space- currently it looks like Babylon.js only allows emission in world space, is this correct? or is there a flag that I've missed? Thanks! Quote Link to comment Share on other sites More sharing options...
Dad72 Posted August 2, 2014 Share Posted August 2, 2014 Yes, correct. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted August 2, 2014 Share Posted August 2, 2014 The minEmitBox and maxEmitBox define a box around the current position of the emitter. They are defined in object space NOT world spaceSame 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); } testure 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.