Hi everyone,
I’m working on a game, where a raycast is set to hit a sphere where gameObjects are instantiated. Because the player just sees the top half of the sphere, I want to create the world new everytime the gameObjects leave the view of the player, but for me, just to instantiate it if it is on the bottom of the sphere works, I need advice on this script:
function GetPointOnMesh() : RaycastHit
{
var length : float = 100.0;
var direction : Vector3 = Random.onUnitSphere ;
var ray : Ray = Ray(world.transform.position + direction*length,-direction);
var hit : RaycastHit;
world.collider.Raycast (ray, hit, length*2);
return hit;
}
With this script, it raycasts from the middle of my sphere to everywhere. Can anyone help me point the raycast to the bottom of the sphere, the bottom half.
Thanks in advance