So I have this code that I am experimenting with, and the inputs and everything works fine, although when I test my Line Renderer, the lines do not match with my Debug.DrawRay test.
Like this:
It gets worse the closer it gets to the origin too:
Here is my code:
void PreJump()
{
//Mouse Pos
Vector3 direction = Vector3.zero;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray)) {
//placeholder values
direction.x = ray.direction.x*50;
direction.y = ray.direction.y * 50;
}
Vector3 top = Calculator.GetTop(gameObject);
//lr is the linerenderer
lr.SetPosition(1, top);
lr.SetPosition(0, direction);
Debug.DrawRay(top,direction);
if (Input.GetKeyDown(KeyCode.Space))
{
jumpDirection = direction;
preJumpPhase = false;
Jump();
}
}
Any help would be appreciated!