Everything works perfectly, except that the origin of the raycast is always at the origin at the feet of the object and doesnt seem to be affected when i use transform up. Whats going on?
public class Test : MonoBehaviour {
private float scaleLimit = 10f;
void Update()
{
ShotgunFire ();
}
public void ShotgunFire()
{
if(Input.GetKey(KeyCode.F))
{
for(int i = 0; i < 30; i ++)
{
float z = 10;
// Generate a random XY point inside a circle:
Vector3 direction = Random.insideUnitCircle * scaleLimit;
direction.z = z; // circle is at Z units
direction = transform.TransformDirection( direction.normalized );
//Raycast and debug
Ray r = new Ray( transform.position + transform.up * 7, direction );
RaycastHit hit;
if( Physics.Raycast( r, out hit ) ) {
Debug.DrawLine( transform.position, hit.point );
}
}
}
}
}