Question by
ZevenDEV · Sep 04, 2015 at 12:22 PM ·
raycastraycasting
Raycast BulletDrop
How can I simulate bulletdrop with a raycast ? I found a few answers but they didn´t really help me.
function shoot()
{
var hit : RaycastHit;
var ray : Ray = Camera.main.ScreenPointToRay(Vector3(Screen.width * 0.5, Screen.height * 0.5, 0));
if(Physics.Raycast(ray, hit, 1500))
{
Debug.Log("Hit");
var hitRotation = Quaternion.FromToRotation(Vector3.up, hit.normal);
Instantiate(bulletHole, hit.point, hitRotation);
}
How can I rotate the ray, the farther away it is ? Thanks !
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612002617im_/https://answers.unity.com/themes/thub/images/avi.jpg)