Forum begins after the advertisement:


[Part 2] Raycast rotating as I move from x = 0 and y = 0

Home Forums Video Game Tutorial Series Creating a Metroidvania in Unity [Part 2] Raycast rotating as I move from x = 0 and y = 0

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #13292
    Daikuna
    Level 2
    Participant
    Helpful?
    Up
    0
    ::

    Not sure what is going on but as I move along the x axis and y axis the raycast line seems to rotate around the character, eventually shooting the raycast up instead of down. Images and code are below.

    View post on imgur.com

    Code:

    
     public bool Grounded(){
            if(Physics2D.Raycast(groundCheckPoint.position, -Vector2.up, groundCheckY, whatIsGround)
            || Physics2D.Raycast(groundCheckPoint.position + new Vector3(groundCheckX, 0 , 0), -Vector2.up, groundCheckY, whatIsGround) 
            || Physics2D.Raycast(groundCheckPoint.position + new Vector3(-groundCheckX, 0 , 0), -Vector2.up, groundCheckY, whatIsGround)){
    
                return true;
    
                //doubleJump = true;
            }
            else{
                return false;
            }
            }
    #13355
    Terence
    Level 30
    Keymaster
    Helpful?
    Up
    0
    ::

    Daikuna, sorry that your topic got filed in spam. I found it and I unflagged it.

    If you haven’t solved this issue, can you show me how you generate your raycast line (i.e. share the code here)?

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Go to Login Page →


Advertisement below: