ycw
September 10, 2019, 9:23pm
1
I have 2 questions about SubEmitter#inheritDirection
q1
When subemitter.inheritDirection=true
, its +y is determined, how to derive +x then?
q2
“When subemitter.inheritDirection=true
, subemitter’s +y is equal to the direction that particle was heading…” [https://doc.babylonjs.com/how_to/sub_emitters ]
Here’s a PG Babylon.js Playground proving that it does not.
Is it a bug ?
Hey!
This is how it is used:
if (subEmitter.inheritDirection) {
emitterMesh.position.subtractToRef(this.direction, TmpVectors.Vector3[0]);
// Look at using Y as forward
emitterMesh.lookAt(TmpVectors.Vector3[0], 0, Math.PI / 2);
}
In other words, the sub particle system emitter is aligned with the particle direction that will emit the new sub system
Does that make more sense?
ycw
September 11, 2019, 2:28am
3
I found that
emitterMesh.position.subtractToRef(this.direction, v)
where v
always approach to v3(0,0,0), then
emitterMesh.lookAt(v, 0, Math.PI/2)
emitterMesh
will always lookAt origin even if the particle is moving the opposite way…
Should L191 at https://github.com/BabylonJS/Babylon.js/blob/da661ef2153e10b0e424c6f93792159b53a0a47f/src/Particles/particle.ts#L192
be
if (..) {
emitterMesh.setDirection(this.direction.normalize(), 0, Math.PI/2);
}
??
Thanks.
good catch! do you want to do a PR?
1 Like