Hi Brightside,

Is your input vector normalized?

The vector is multiplied by RayLength when calculating the new position, this seems to indicate the vector is of unit length and must be scaled in order to span from A to B.

However the input vector is merely inverted to calculate the new vector, indicating that the input vector is of non-unit length and already spans from A to B.

If the input vector already spans from A to B, the solution is to remove *RayLength when calculating the new position.

tPos.x=VertexPosition(v).x+tVector.x
tPos.y=VertexPosition(v).y+tVector.y
tPos.z=VertexPosition(v).z+tVector.z
tVector.x=tVector.x*-1
tVector.y=tVector.y*-1
tVector.z=tVector.z*-1

If the input vector is unit length, the solution is to add *RayLength when calculating the new vector.

tPos.x=VertexPosition(v).x+tVector.x*RayLength
tPos.y=VertexPosition(v).y+tVector.y*RayLength
tPos.z=VertexPosition(v).z+tVector.z*RayLength
tVector.x=tVector.x*-1*RayLength
tVector.y=tVector.y*-1*RayLength
tVector.z=tVector.z*-1*RayLength