Need help! Line renderer raycast.

Hello,i need help to finish this script and thats all.I just want raycast detects player when i touch line renderer and then print(“massage”).So i need help to finish this script by putting raycast in it:

private var lRenderer : LineRenderer;

function Start() {
lRenderer = gameObject.GetComponent (LineRenderer) as LineRenderer;

}

When player is touched line renderer,then print(“massage”).Thank you guys for attention and please help me. :slight_smile:

Can ANYONE HELP ME!?!?!?!?!?!?!?!?

First of all, you should add collider to your LineRenderer (mesh collider is better)
Next, try this turtorial to understand how to add trigger
http://www.unity3dstudent.com/2010/07/beginner-b13-trigger-collision-detection/

Cant add collider,cant cause its gonna fu** the line renerer,please help me guys,been waiting trying everything for 4 weeks.

I don’t know what you meant. I think collider not effect to any rendering

I have different line renderer,well i just need raycast script? Is it realy hard?

Physics.Raycast

Try -anything-, then come back and ask what you’ve done wrong.

It works very buggy,i need something like that,but only a bit modified,that it works for line renderer.

Can anyone please fuc*ing help me???

Calm the hell down.

Introducing angry words only makes us angry and less willing to help. How can you possibly not understand that?

Raycast along your line renderer. From origin to end of each segment. If it hits the player then it has hit the player.

1 Like