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();
}
}
}
}