Jump to content

Star Sphere w/ particle sustem


Pryme8
 Share

Recommended Posts

https://www.babylonjs-playground.com/#WBQ8EM#12

I am trying to figure out how to generate a particle "star sphere"

I don't have much time today to dink around with it so I was hoping that someone could help me out.

Link to comment
Share on other sites

system* ... also the playground won't load for me... not sure why...

maybe something with moving the spawn point of the particles I would guess...?  Except instead of making it a circle make it a star... assuming thats what you meant... I can't really tell...

oh like looking out into the stars maybe?  then make the position follow a sphere code... 

ParticlesA.startPositionFunction = function(worldMatrix,positionToUpdate){
var rndAngle = 2*Math.random()*Math.PI;
var randX =this.minEmitBox.y;
var randY = radius*Math.cos(rndAngle)
var randZ = radius*Math.sin(rndAngle);
 
ParticlesA.direction1 = new BABYLON.Vector3(0,-randY*2,-randZ*2);
ParticlesA.direction2 = new BABYLON.Vector3(0,-randY*2,-randZ*2);
BABYLON.Vector3.TransformCoordinatesFromFloatsToRef(randX, randY, randZ, worldMatrix, positionToUpdate)
 
};
Link to comment
Share on other sites

10 minutes ago, Pryme8 said:

https://www.babylonjs-playground.com/#WBQ8EM#13

Ive got it but for some reason on my local version the line:
    sphereEmitter.radiusRange = 0;

Is not restricting the particles to the surface of the emitter.

 

Maybe set it to -0.1 or something slightly outside? or play with the numbers to extreme (-1/1) to see if its actually sphereEmitter.radiusRange that is the problem...

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...