Have geometry always face the camera?
alexpineda opened this issue · comments
I'm attempting to modify the cavalier speed particles demo to have them always face the camera but am having difficulty.
I was told I had to convert the units to camera-space (https://www.gamedeveloper.com/programming/building-an-advanced-particle-system). However I'm not really certain how to do that and then transform back.
vertexPosition: [
// calculate a time based on the uniform time and the offset of each prefab
'float tProgress = mod((uTime + (aOffset * uDuration)), uDuration) / uDuration;',
// convert to camera space here and do something? <--
'vec4 myTransform = vec4(position, 1.) * modelViewMatrix ;',
// scale the z axis based on the uniform speed scale
'transformed.z *= uScale;',
// translate between start and end position based on progress
'transformed += mix(aStartPosition, aEndPosition, tProgress);',
],