Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

Search the Community

Showing results for tags 'bullet marks'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GENERAL
    • Introduce yourself
    • Discussions
    • Showcase
    • Need help?
    • Seeking team members?
    • Offtopic
  • RESOURCES
    • Example Projects
    • Scripts
    • Shaders
    • Unity Tutorials
    • FPS Kit Tutorials
    • 3D models
    • Animated 3D Models
    • Graphic design
    • Textures
    • Sounds
    • Other
  • SELL | REQUEST
    • Sell
    • Request
  • Mars' Modular Multiplayer Photon FPS Kit's Topics
  • Mars' Modular Multiplayer Photon FPS Kit's Reviews
  • Mars' Modular Multiplayer Photon FPS Kit's Updates
  • Mars' Modular Multiplayer Photon FPS Kit's Tutorials
  • Busy People's Introductions
  • Photon's Tutorials
  • Photon's Photon General
  • Photon's Showcase

Categories

  • Free Projects
  • Free Assets
  • Game Demos
  • Photon's Files

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


YouTube URL


Facebook URL


Twitter URL


IndieGoGo URL


Kickstarter URL


IndieDB URL


GreenLight URL


Location:


Interests

Found 1 result

  1. Hi I'm trying to create a particle system that will appear on my bullet hole decal, Please explain how i would create this effect for different surfaces or just one generic one i could play with. Here is gun code: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class GunScript : MonoBehaviour { public Camera weaponCamera; public LayerMask thingsPlayerCanHit; public enum fireMode { Auto, Semi} public fireMode weaponType = fireMode.Auto; [Space] public float range; public float fireRate; public int minDamage; public int maxDamage; [Space] public Vector3 defaultPosition; public Vector3 aimedPostion; public float aimSpeed; public float aimFOV; [Space] public int clipSize; public int allAmmo; [Space] public Animation weaponAnimations; public AnimationClip fireAnim; public AnimationClip reloadAnim; [Space] public AudioSource weaponAudio; public AudioClip fireEffect; public AudioClip reloadEffect; public GameObject bulletHole; [Space] public GameObject muzzle; bool muzzleFlash = false; public Vector3 aimRotation; bool canFire; bool isReloading; [HideInInspector] public bool isSilencered; int currentAmmo; private void Start() { canFire = true; currentAmmo = clipSize; } private void Update() { CheckAimDownSights(); if (canFire) { if (currentAmmo <= 0) { Reload(); return; } if (weaponType == fireMode.Auto) { if (Input.GetButton("Fire1")) { StartCoroutine("Fire"); canFire = false; } } else if (weaponType == fireMode.Semi) { if (Input.GetButtonDown("Fire1")) { StartCoroutine("Fire"); canFire = false; } } } if (Input.GetKeyDown(KeyCode.R)) { Reload(); } } IEnumerator Fire() { currentAmmo--; weaponAnimations.Stop(); weaponAnimations.Play(fireAnim.name); weaponAudio.PlayOneShot(fireEffect); if (!isSilencered) StartCoroutine("FireEffects"); Ray ray = weaponCamera.ScreenPointToRay(new Vector2(Screen.width / 2, Screen.height / 2)); RaycastHit hitInfo; //Bullet Marks if (Physics.Raycast(ray, out hitInfo, weaponCamera.farClipPlane)) { Vector3 bulletHolePosition = hitInfo.point; // We need a variable to hold the rotation of the prefab // The new rotation will be a match between the quad vector forward axis and the hit normal Quaternion bulletHoleRotation = Quaternion.FromToRotation(-Vector3.forward, hitInfo.normal); GameObject hole = (GameObject)GameObject.Instantiate(bulletHole, bulletHolePosition, bulletHoleRotation); } yield return new WaitForSeconds(fireRate); Destroy(bulletHole); canFire = true; } IEnumerator FireEffects () { if (muzzleFlash) // Has muzzle flash? { muzzle.SetActive(true); // Active the muzzle flash. muzzle.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, Random.Range(0, 360))); // Sets a random rotation. yield return new WaitForSeconds(0.03f); // Awaits the 3 millisecond interval. muzzle.SetActive(false); // Disable the muzzle flash. } } float GetWeaponDamage(float distance) { float damageToDeal = (maxDamage - minDamage) * (1 - (distance / range)); return damageToDeal; } void Reload() { if (currentAmmo == clipSize || allAmmo == 0) return; weaponAudio.PlayOneShot(reloadEffect); if(allAmmo >= (clipSize - currentAmmo)) { allAmmo -= (clipSize - currentAmmo); currentAmmo += (clipSize - currentAmmo); } else { currentAmmo += allAmmo; allAmmo = 0; } isReloading = true; canFire = false; weaponAnimations.CrossFade(reloadAnim.name); StartCoroutine("ReturnFromReloading"); } IEnumerator ReturnFromReloading() { yield return new WaitForSeconds(reloadAnim.length); canFire = true; isReloading = false; } void CheckAimDownSights() { if (Input.GetButton("Fire2") && !isReloading) { transform.localRotation = Quaternion.Lerp (transform.localRotation, Quaternion.Euler (aimRotation), Time.deltaTime * aimSpeed); transform.localPosition = Vector3.Lerp (transform.localPosition, aimedPostion, Time.deltaTime * aimSpeed); } else { transform.localPosition = Vector3.Lerp(transform.localPosition, defaultPosition, Time.deltaTime * aimSpeed); transform.localPosition = Vector3.Lerp (transform.localPosition, defaultPosition, Time.deltaTime * aimSpeed); } } void OnGUI (){ // GUI.Box (new Rect (10, 10, 100, 50 ("Ammo is"))); GUI.Label(new Rect(10, 10, 100, 50), currentAmmo.ToString() + " / " + allAmmo.ToString()); } } I have already created prefab of metal with shader Particle/additive. Any help is appreciated here.
×
×
  • Create New...