Home > other >  Ray detection
Ray detection

Time:09-24

Let the camera has been in the update emission rays, record the camera to meet on the floor of the first
the coordinates of point

CodePudding user response:

The floor alone to a layer, Raycast layer and only the collision

CodePudding user response:

Math library is not a ray and plane intersection algorithm,

CodePudding user response:

Vector3 hitposition=[the coordinates of the point on the screen]
Ray mouseRay=camera. ScreenPointToRay (hitposition);
RaycastHit hit;
If (Physics. Raycast (mouseRay, out hit))
{
If (hit) starts. GameObject. Name=="terrain name")
{
Vector3 des=hit. Point;//and the intersection of terrain
}
}
  • Related