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 'laser'.



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 5 results

  1. How to make a Laser Beam Effect Hi guys! I decided to contribute a little to this incredible community and release a tutorial. Even if it's simple, it may be useful for some people. Here i'm gonna teach you how to make a Laser beam effect. First of all, this is the final effect we're going to achieve: Let's start: 1 - Create an empty gameObject and make it a child of your gun object in the hierarchy. Name it whatever you want. (Something like, "laser"). 2 - With the "laser" GameObject selected, go to: Component > Effects > Line Renderer. 3 - Get a Perlin Noise texture like this one: 4 - Create a new material with a Self-Ilumination/Diffuse Shader and assign the noise texture as the base texture of the material and the illumination too. 5 - Change the material color to green (or red if you like). 6 - Assign this material to the line renderer and adjust the settings (I recommend putting the start width to something very low, in this example, i'm using "0.0005"). This part creates the laser beam itself. Now let's do the light emmited where the laser hits. You'll need to use this script: (LaserBeam.js) #pragma strict var LaserOrigin: Transform; // Put the laser (line renderer) object here. var LaserTarget: Transform; //The point light object. function Update () { var ray = new Ray(LaserOrigin.transform.position, LaserOrigin.transform.forward); //Casts a new ray var hit: RaycastHit; if(Physics.Raycast(ray, hit, Mathf.Infinity)) { LaserTarget.transform.position = hit.point; //Positions the light at the same point the laser hits something. } } 7 - Assign the variables (they're explained as comments in the script) 8 - For the point light, simply create a point light, and assign it a small range, but a high intensity. (In the example: 0.31 - Range; and 1.57 - Intensity) Now the point light will illuminate the place the laser hits. Be aware that this will increase the draw call count (here it increased 3 draw calls). The performance hit is unnoticeable for me, as I'm using Deferred Rendering, and light costs the amount of pixels illuminated. If you're using Forward Rendering, it costs the amount of objects illuminated. ------------------------------------------------- Tell me what do you guys think and if you have another method let us know! I Hope it helps someone!
  2. Hi #pragma strict var LaserOrigin: Transform; // Put the laser (line renderer) object here. var LaserTarget: Transform; //The point light object. function Update () { var ray = new Ray(LaserOrigin.transform.position, LaserOrigin.transform.forward); //Casts a new ray var hit: RaycastHit; if(Physics.Raycast(ray, hit, Mathf.Infinity)) { LaserTarget.transform.position = hit.point; //Positions the light at the same point the laser hits something. } }
  3. matheusfig1

    Laser Cannon

    1 - Create an Empty GO named LazerCannon. 2 - Create an EmptyGO named Lazer(that have to be son of the Lazer Cannon). 3 - Add a LineRenderer to the Lazer, set the end and the start width as 0,01. 4 - Create a cube into the Lazer(as son of the Lazer) remove this Components: - Mesh Filter. - Mesh Renderer 5 - Set the size as | X: 50 | Y: 50 | Z: 0,05 | 6 - Set the collider as trigger. 7 - The Z position of the cube is the range of the laser(lazer script dont have a range). Script that goes in the Lazer : private var Range = Mathf.Infinity; var StartPos : Vector3; private var End : Vector3; var Enabled = true; private var Poss : LineRenderer; function Start () { Poss = this.gameObject.GetComponent(LineRenderer); } function Update () { RayLaser (); //Multple times to "acelerate" the update time StartPos = this.gameObject.transform.position; StartPos = this.gameObject.transform.position; StartPos = this.gameObject.transform.position; StartPos = this.gameObject.transform.position; StartPos = this.gameObject.transform.position; Poss.enabled = false; if(Enabled == true){ Poss.enabled = true; Poss.SetPosition(0, StartPos); Poss.SetPosition(1, End); } if(Enabled == false) { Poss.enabled = false; } } function RayLaser () { var hit : RaycastHit; var Direction = transform.forward; if(Physics.Raycast(transform.position,Direction,hit,Range)){ if(hit.collider.gameObject){ //Multple times to "acelerate" the update time End = hit.point; End = hit.point; End = hit.point; End = hit.point; End = hit.point; } } } Dont forget to assign a material to the lazer. An Image of the ready lazer cannon: https://www.dropbox.com/s/8nwou0as7fp42xv/LazerRenderer.png
  4. Hey guys! Here's a Laser Beam script! If you want to know how to use it, here's the tutorial topic: "How to make a Laser Beam Effect" #pragma strict var LaserOrigin: Transform; // Put the laser (line renderer) object here. var LaserTarget: Transform; //The point light object. function Update () { var ray = new Ray(LaserOrigin.transform.position, LaserOrigin.transform.forward); //Casts a new ray var hit: RaycastHit; if(Physics.Raycast(ray, hit, Mathf.Infinity)){ LaserTarget.transform.position = hit.point; //Positions the light at the same point the laser hits something. } }
  5. So here is a script for a laser-pointer attachment. Usage: - Create empty GO and add line renderer component and this script. - Settings: Look at attached files - Place the GO to the laser start position - Assign the bullet spawn of your weapon - If you have a laser dot, assign it to laser endpoint Instructions for laser dot: - Create empty GO - Create Quad and rotate it on X 90 degrees (Quad is new in Unity 4.2, like a plane except with less poly) - Assign your material and make the quad a child of the empty GO - Set Quad position to 0,0,0 - Make the GO a child of the laser pointer using UnityEngine; public class Laserpointer : MonoBehaviour { public LineRenderer lineRenderer; public Transform bulletSpawn; public GameObject laserEndpoint; public int range = 30; public void Update() { lineRenderer.SetPosition(0, transform.position); RaycastHit hit; if (Physics.Raycast(bulletSpawn.position, bulletSpawn.forward, out hit, range)) { lineRenderer.SetPosition(1, hit.point); if (laserEndpoint) { laserEndpoint.SetActive(true); laserEndpoint.transform.position = hit.point + hit.normal * 0.01f; laserEndpoint.transform.rotation = Quaternion.FromToRotation(Vector3.up, hit.normal); } } else { lineRenderer.SetPosition(1, transform.position + transform.forward * range); if (laserEndpoint) laserEndpoint.SetActive(false); } } }
×
×
  • Create New...