Raycast on moving object?

My problem is that I have a rocket moving forward (transform.translate.forward * speed) and I also have a raycast in the Update function and it looks like the raycast is late for some reason.

(My Raycast)

if (Physics.Raycast(transform.position, transform.forward, out hit, 1))

I tried Debug.Drawray and the ray is late and looks as if it is shooting out of the back of the rocket. If i have the rocket speed set to 0 then the ray looks fine, but the moment it starts moving it looks late.

(My Drawray)

Debug.DrawRay(transform.position, transform.forward, Color.blue, 1);

I have tried moving the transform.translate to the fixed update and have tried moving the raycast also to the fixed update etc…

Any help would be appreciated

Did you ever figure this out?

I have figured this out @kylenoll123, if you haven’t done so already.

Always had this annoying little problem when creating 2D controller collisions, because my character would get stuck in walls constantly.

Basically, the length that your ray is late by, is the length that the rocket has moved in the previous frame. This makes sense?

Here, a masterfully crafted image to illustrate this:

I hope it’s clear enough, took me several months to get to this simple conclusion…