x


Before updating to Windows 10 you may need to return your Pro license. More information here

How do I make a laser pointer?

I am making a top down shooter and I would like to know how to make a laser pointer. I currently have a directional light, but that only shows where it hits, I want it to light up it's whole path in a small beam.

more ▼

asked Aug 25, 2010 at 01:51 AM

avatar image

MonkeyAssassin8
481 101 81 87

I actually want what you originally had. A light that shows where it hits without going through the object. You said directional light. Did you mean spot light? Could you say how you achieved it.

May 31, 2011 at 02:01 PM Twayne
(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

maybe the code would be like this?:

function Update () { var lineRenderer : LineRenderer = GetComponent(LineRenderer); lineRenderer.useWorldSpace = false; lineRenderer.SetVertexCount(2); var hit : RaycastHit; Physics.Raycast(transform.position,transform.forward,hit); if(hit.collider){ lineRenderer.SetPosition(1,Vector3(0,0,hit.distance)); } else{ lineRenderer.SetPosition(1,Vector3(0,0,5000)); } }

@script RequireComponent(LineRenderer)

and use a texture like this

more ▼

answered Aug 25, 2010 at 01:54 PM

avatar image

3dDude
3k 185 162 183

(comments are locked)
10|3000 characters needed characters left

I think you want a Line Renderer.

more ▼

answered Aug 25, 2010 at 02:12 AM

avatar image

qJake
13.3k 93 173 259

How do I make it stop when it hits an object, eg wall?

Aug 25, 2010 at 02:28 AM MonkeyAssassin8

how do i texture it?

Aug 10, 2011 at 06:45 PM AdamEstone
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x226
x191
x97
x71

asked: Aug 25, 2010 at 01:51 AM

Seen: 8217 times

Last Updated: Aug 10, 2011 at 06:45 PM