i added shader
const dust = new THREE.Points(geometry, material);
scene.add(dust);
it updates in gameloop
const positionAttribute = dustGeometry.getAttribute("position");
for (let i = 0; i < count; i++) {
const i3 = i * 3;
...
if (positionAttribute.array[i3 + 1] > 2.5) {
positionAttribute.array[i3] = (Math.random() - 0.5) * 8;
positionAttribute.array[i3 + 1] = -2.5;
positionAttribute.array[i3 + 2] = (Math.random() - 0.5) * 4;
}
and there i use these lines to allow dust follow rcCar
let throughDiffDustAndRCCar = new THREE.Vector3().subVectors(new THREE.Vector3(dust.position.x,0, dust.position.z), new THREE.Vector3(samplePickRCCar.position.x,0, samplePickRCCar.position.z) )
dust.position.copy({x: samplePickRCCar.position.x, y: camera.position.y, z: samplePickRCCar.position.z + throughDiffDustAndRCCar.z })
the issue is that samplePickRCCar.position.z and dust.position.z are expected to be different to allow dust be shown in camera
what diff of vectors i may use?
dust expected to be in the end of the car, it depends of camera.y
and there diff between rcCar.position.z and dust.position.z to be shown in camera