Hi there,
I am currently trying to use Physics.Raycast however I am not having any luck…
I was expecting that when the ray passes the ground for the yellow ray and the debug to show.
The rays are being shot from the centre of the sphere, once the rays collide with the ground a second ray should appear.
This is my current code:
for (int i = 0; i < points.Count; i++) { Vector3 direction = (PlanetMesh.current.planetCore - points*).normalized;* *Ray ray = new Ray(PlanetMesh.current.planetCore, -direction);* *RaycastHit hit;* *if (Physics.Raycast(ray, out hit, 1000, ground))* *{* _Debug.DrawRay(PlanetMesh.current.planetCore, -direction * 1000, Color.yellow, 0.5f);_ *Debug.Log("Hit the ground");* *}* _Debug.DrawRay(PlanetMesh.current.planetCore, -direction * 1000, Color.green, 0.5f);_ *}
*
As you can see in the picture the green rays are always firing which is as expected, just unsure why my IF statement is not working… Any guidance or help would be much appreciated. Thanks[151769-raycast.png|151769]*
*