TerrainCollider.Raycast

I’m having some difficulty with the raycast.

I have an interface setup where the screen is split into four quadrants, each with an over shoulder cam and seperate controlable character.

To get a destination for one of the characters I’m tryng to use a screenPointToRay through the mouse, returning hit location when it hit’s the terrain. I’ve managed to isolate the apropriate camera out of the four to send th ray from bhut havign implemented pretty much identicle code to that in the scripting reference the console window tells me that there is no such mehtod as UnityEngine.TerrainCollider.Raycast.

Any ideas?

It’s actually Physics.Raycast that you need for something like this.

That seems to have done the trick. Thanks.

Physics.Raycast[All] might be all fine and good and work and everything, but what if you have other colliders? Now you have to loop thru every collider until you match up with the terrain collider to determine where the ray intersects with the terrain. That seems inefficient and unnecessary, when you should be able to just grab the terrain collider and use TerrainCollider.Raycast on it specifically to get exactly the result you want. ESPECIALLY since the documentation implies that it works.

ED: Ok, I just noticed the layers param in the physics raycast. Still, everything implies that the other method should work too.