Question by
Damastasam · Dec 31, 2016 at 03:23 PM ·
raycastraycastingdashblink
Blink, Dash, Raycasting
So, i am creating a Dash script, but no one has proper help anywhere that i can find, its an fps, and wherever you look and if you press fire1 (mouse leftclick) you telleport (dash) lets say 10 units ahead. But, my problem is that im not even telleporting in-game, and i really dont know what i SHOULD be doing.
public Transform cam;
public RaycastHit hit;
public Transform character;
public float range = 10;
private Transform ray;
// Update is called once per frame
void FixedUpdate () {
Vector3 origin = transform.position;
Vector3 direction = cam.transform.forward;
Physics.Raycast (origin, direction, range);
if (Input.GetButtonDown("Fire1")) {
origin += direction * range;
}
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612103729im_/https://answers.unity.com/themes/thub/images/avi.jpg)