I am trying to create a raycast to extend from the bottom left of a player to the bottom right as I am going to create a super mario bros type game.
My goal is to make a script that when the raycast on the bottom of my player hits the enemy (when I jump on them) it kills them. But I cant get the raycast to display, any tips or do I have a fundamental misunderstanding of what raycasts are supposed to be used for?
My code is below, it is in the update function
Vector2 playerSize = GetComponent<BoxCollider2D>().bounds.size;
RaycastHit2D attackJump = Physics2D.Raycast(jumpRayObject.transform.position,
Vector2.right, playerSize.x);
Debug.DrawRay(jumpRayObject.transform.position, Vector2.right * attackJump.distance,
Color.red);