Search Unity

My character is stuck in the air

Discussion in 'Visual Scripting' started by jellybunnybean05, Aug 15, 2022.

  1. jellybunnybean05

    jellybunnybean05

    Joined:
    Jan 27, 2022
    Posts:
    22
    Hi again, Unity. (I swear I'm gonna have to make a new question every day.) I'm following a Unity tutorial about how to use Bolt to make a 2d platformer. I've copied the various the graphs that are shown in the gifs, but I'm not using the prefab that Unity's using. But my character is in the air, not on the ground where I've placed some tiles. She can move (I still need to flip her, I'm about to do that), but she's not on the ground.

    I've attached screenshots. Is there a way I can control the Y value, given that I'm using specific Bolt nodes from the tutorial? Or is my character meant to be up there?

    @Kurt-Dekker, @Cornysam, do you know what's wrong?

    BTW, here's the link to the tutorial: Character Controller - Unity Learn
     

    Attached Files:

  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,686
    As I linked to you yesterday, there is a bolt scripting forum. That's where bolt questions should be posted.
     
  3. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,452
    I'll move your post to the Visual Scripting forum because it's a question related to that.

    Also, please ensure that tagging in users for your questions is something they actually want. Some don't mind but it's good etiquette to ask first assuming you've not already.
     
    Kurt-Dekker likes this.
  4. jellybunnybean05

    jellybunnybean05

    Joined:
    Jan 27, 2022
    Posts:
    22
    OK, I'll remember for next time. Thanks, guys. :)

    EDIT: My page says that I did post in the Visual Scripting section, unless that's because it was moved. But I was in the Visual Scripting section earlier...hm. But like I said, I'll remember to post in the right section next time (and remember to ask if I want specific people to help me).
     
  5. Kreshi

    Kreshi

    Joined:
    Jan 12, 2015
    Posts:
    445
    I am not familar with visual scripting but in your graph you are setting velocity.y to your rigidbodys velocity.y without adding any additional gravity. Depending on your rigidbody settings (like appy gravity set to false or is kinematic set to true for example) your issue could be here.
     
  6. jellybunnybean05

    jellybunnybean05

    Joined:
    Jan 27, 2022
    Posts:
    22
    OK. Where could I fix the gravity (without making my character fall forever)?

    BTW, here's a snip of my Rigidbody and my Collider.

     
  7. jellybunnybean05

    jellybunnybean05

    Joined:
    Jan 27, 2022
    Posts:
    22
    I thought I could edit my above post and attach it. Here it is.
     

    Attached Files:

  8. Kreshi

    Kreshi

    Joined:
    Jan 12, 2015
    Posts:
    445
    Your character won't fall forever when you have a ground with a collider underneath :).
    In general gravity can be applied like this:

    rigidbody.velocity += Gravity * Time.deltaTime;
     
  9. jellybunnybean05

    jellybunnybean05

    Joined:
    Jan 27, 2022
    Posts:
    22
    OK, thank you! I'll need to find the Visual Script that's equivalent to that, if I'm not using C# at all.