-
Notifications
You must be signed in to change notification settings - Fork 118
'disk' emitter, radiusSpread, angles #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
stemkoski
commented
Sep 6, 2013
- Included disk-shaped emitter
- now able to randomize radius size for sphere/disk emitter
- particles can have an angle, angle can be randomized or aligned to velocity direction
- fixed _resetParticle velocity direction issue
- TODO: incorporate angleVelocity for rotating particles
* Included disk-shaped emitter * now able to randomize radius size for sphere/disk emitter * particles can have an angle, angle can be randomized or aligned to velocity direction * fixed _resetParticle velocity direction issue * TODO: incorporate angleVelocity for rotating particles
|
I've not had a chance to have a look at this in action yet, but had a look at the code on the bus whilst on my way to work this morning - looks awesome; thanks as well for using the same code-style, makes a huge difference :) From what I could garner from looking at the code earlier though, I'm wondering if the 'disk' type is redundant - doesn't this just mirror the radiusScale property should this property be set to new THREE.Vector3(1, 1, 0)? I could be wrong since I've not seen it in action yet... |
|
I initially thought along the same lines, but multiplying the z-radius by 0 On Sep 6, 2013 6:20 AM, "Luke Moody" notifications@github.com wrote:
|
'disk' emitter, radiusSpread, angles
|
Ah yeah, I didn't think of that, good point. I've merged your pull reqs and discovered that in To get around the problem, I just used v.copy(), or v.set() instead, depending on the function. But that did all sorts of weird things (angles were out of alignment, etc.) After a bit of digging, I realised that the velocity shader attribute was never getting marked as needing to be updated in I've pushed these changes to a new branch called As a little aside, I'm so disappointed that a particle's angle only works in 2d space. I remember being as disappointed when I first discovered this a while ago (there went my hope for using bullet-shaped particles in my game). Techically, one could squash the textures to reflect the z-rotation, but get them travelling on the same plane as the camera and they'd be invisible. Oh well! |
|
I think that there is a mathematical solution to this problem -- the angle of the sprites needs to take the position of the camera into account. Initially, the camera is looking along the negative z-axis, so using the x and y components of velocity to calculate the angle of rotation for the sprites makes sense. In general, however, we would want to project the velocity vector into the plane perpendicular to the vector along which the camera is looking, and if the projection has coordinates (v_1, v_2), then the angle of rotation for displaying the sprites should be Math.atan(v_2, v_1). |
|
That's a good idea. My maths is a bit shaky (I'm technically an English Lit grad!), but could we use the vertex shader's I might experiment with this tonight and see if I make any headway... |