Search Unity

Question How do I check if the players vertical speed is negative

Discussion in 'Scripting' started by roblenoa000, Feb 2, 2023.

  1. roblenoa000

    roblenoa000

    Joined:
    Sep 12, 2022
    Posts:
    5
    I am trying implement a gliding feature in my game and I can figure out how it get it to work only after the apex of the jump. I have a variable for vertical speed that is defined every frame, my problem is I get an error when I go to check to see if the vortical speed is a negative number and says that what I'm trying to do is invalid

    here is the if statement I'm trying to do:
    if (vertSpeed =< 0)


    I am still learning unity so if there is an obvious solution I missed, my bad.

    Edit: As user "spiney199" pointed out I had the symbols the wrong way around.
     
    Last edited: Feb 2, 2023
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,927