I'm currently working on implementing the elusive bullet tracer to my FPS. It isn't going so well.
a. The tracers align themselves off of the barrel of the Raycast area
b. They all aim themselves in the same direction, no matter where I point my cursor
This is the formula I'm currently using to calculate where the tracers should go.
fwd.x += Random.Range(-accuracy, accuracy);
fwd.y += Random.Range(-accuracy, accuracy);
fwd.z += Random.Range(-accuracy, accuracy);
Instantiate(tracer, transform.position, Quaternion.LookRotation((fwd - transform.position).normalized));
The code is Unityscript (js). Thank you!
Quaternion.LookRotation((fwd - transform.position).normalized)
needs to beQuaternion.LookRotation(fwd.normalized)