Hi all
I’m making a VR project and I’m using a Raycast as a laser from the player’s hand for moving agent’s from one place to another.
What I want to happen is that when the laser is cast and the endpoint hits an oversized collider of the object, I make the endpoint of the laser snap to that object.
Once I’ve figured a simple way of getting this working with a single object, I’ll be able to move on and use multiple objects.
Here’s what I have so far. The part I’m not sure of is just to make the end of the Raycast snap to the centre of the object.
Thanks!
if (Physics.Raycast(laserPosition.transform.position, laserPosition.transform.forward, out hit))
{
if (hit.collider == waypoint)
{
// ????????????
}
}