How do would i rotate a Raycast2D as a cube rotates
Hi all, does anybody know how I would go about rotating a Vector2 Raycast at the same time as my cube game object, I have cube gameobject with the following script attached.
void Update () {
if(Input.GetKey(KeyCode.A))
{
transform.Rotate(0, 0, -1);
}
I then have an empty object set as a child to the cube which has the following script attached
void Update () {
Ray2D myray = new Ray2D(transform.position, Vector2.down);
Debug.DrawRay(transform.position, Vector2.down * 2);
}
I haven't bothered setting a variable for vector2.down as of yet, as i'm not sure the best way to go about things ?
Many thanks
Matt
Comment
Your answer
Follow this Question
Related Questions
2d object moves only a little then stops 0 Answers
ScreenPointToRay 0 Answers
Basic AI avoidance in 2D 1 Answer
Visualise Physics2D.BoxCastAll 1 Answer
Hookshot in Unity 2D not working,Hookshot 2D not working 0 Answers