Bullet Tracers

Hi again!!!

After I got my recoil working (Thanks again to everyone who helped me!) I moved onto a new thing. Bullet tracers. I however can not get it working. I am using the bottom part of the FPS Tutorial shooting script for raycasting my particles on impact. All that works well and I also spawn a bullet when I hit something for damage perposes. I want a tracer that traces where the bullet is going but that seems impossible. I have tried making it shoot a bullet but that dosn’t work the greatest for the particles. So, if anyone has any ideas on how to make bullet tracers for my bullets. (I was thinking mabey if there is a way to slow down particles or something like thst to make the tracer visable) I would also if posible make it so the bullets drop over time. Any help will be helpfull! Thanks!!! Heres the script just in case.

function FireOneShot () {

var hit : RaycastHit;

var direction = SprayDirection();

// Did we hit anything?

if (Physics.Raycast (transform.position, direction, hit, range)) {

	// Apply a force to the rigidbody we hit

	if (hit.rigidbody)

		hit.rigidbody.AddForceAtPosition(force * direction, hit.point);

	

	// Place the particle system for spawing out of place where we hit the surface!

	// And spawn a couple of particles

	if (hitParticles) {

	Instantiate(Bullet, hit.point, Quaternion.identity);

	if(hit.collider.tag == "Spark") {

		Instantiate(decalHitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotation(hit.normal));

		hitParticles.transform.position = hit.point;

		hitParticles.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

		hitParticles.Emit();

	}

	if (hit.collider.tag == "Head") {

		hitParticles2.transform.position = hit.point;

		hitParticles2.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

		hitParticles2.Emit();

	}

	if (hit.collider.tag == "Chest") {

		hitParticles2.transform.position = hit.point;

		hitParticles2.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

		hitParticles2.Emit();

	}

	if (hit.collider.tag == "Arm") {

		hitParticles2.transform.position = hit.point;

		hitParticles2.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

		hitParticles2.Emit();

	}

	if (hit.collider.tag == "Leg") {

		hitParticles2.transform.position = hit.point;

		hitParticles2.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

		hitParticles2.Emit();

	}

	if (hit.collider.tag == "Dirt") {

	    Instantiate(decalHitWall, hit.point + (hit.normal * floatInFrontOfWall), Quaternion.LookRotation(hit.normal));

		hitParticles3.transform.position = hit.point;

		hitParticles3.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal);

		hitParticles3.Emit();

	}

}

}

}

The link below may be of some use to you. It allows you to draw a line form point a - b (which can be determined using raycast finding an initial poitn and the collision point). You also have control over the time duration of the line so it can be rendered over a single frame which may replicate a tracer bullet.

DrawLine

well it depends on how u set it up i have mine set up on my gun script it instantiates the bullet my bullet is a empty gameobject with a script my script is the raycast script making the gameobject a raycast then i set and add a component trail renderer on the gameobject and messed with it i gave my raycast a light so u can see it light up when it flys by something and makes it really cool for when i make a nightime scene the reason why my raycast looks cool though is i have a raycast weight script that makes the raycast like a real bullet its really cool and the tracers help you see where your bullets go when using the sniper rifle to know how much to go up or down with your scope thats how i do mine

I had this same question, I solved it by making a prefab with a line renderer that rendered a short yellow line. I then spawned an instance at each shot, faced it towards the hit point and on update moved it towards the target, then deleted it when it reached.

Hope that helps