Exit for a line trace

Hi, I have solved this problem by combining linetrace with sphere-collider. Since linetrace doesnt have exit event we use sphere collider on contact position. Radius of Sphere collider can be whatever but lets say 20.0 units. We call this sphere a ‘hand’ and parent it inside our player. Each time our ray hits an object it set Hand location to that point. There you can use OnComponentBegin/EndOberlap to call LookAtObject and pass collided object. Only object that implements LookAtObject interface will have implementation how to do effects (hidden in game toggle). Hope this helps you.

1 Like