- Home /
Question by
xxxkoddaxxx · Aug 26, 2015 at 12:39 PM ·
raycastraycastingraycasthit
RaycastHit.point Collider issue C#
I am having a issue with my RaycastHit.point variable. I am trying to get an exact world position but the raycast is only giving me a collider center position.
void Update () {
if(Physics.Raycast(CurrentCar.transform.position, -CurrentCar.transform.forward, out BasicGunRayHit, 1000)){
lookAtBasicGun = BasicGunRayHit.transform.position;
lookAtBasicGun.y = BasicGunPosition.transform.rotation.y;
BasicGunPosition.transform.LookAt(lookAtBasicGun);
Debug.DrawLine (transform.position, BasicGunRayHit.point, Color.red);
Debug.Log(BasicGunRayHit.point);
}
Comment
Your answer
Follow this Question
Related Questions
Raycast script help? 1 Answer
Raycast hit in OnDrawGizmos but not in Update 1 Answer
Vehicle is vibrating on the edge of the ramp/surface when I get the normal of the surface 0 Answers
Help finding out which side of a cube a raycast hits 1 Answer
Ray cast affects all colliders in scene if mouse button is not releasesd. 1 Answer