x


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

MonkeyAssassin8 gravatar image

MonkeyAssassin8
391 100 79 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

3dDude gravatar image

3dDude
2.9k 184 160 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

qJake gravatar image

qJake
12.8k 92 149 237

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:

x204
x155
x86
x56

asked: Aug 25, 2010 at 01:51 AM

Seen: 7643 times

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