Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Bug Rigidbody2D wrong behavior

Discussion in 'Editor & General Support' started by zh4r0naX, Sep 16, 2022.

  1. zh4r0naX

    zh4r0naX

    Joined:
    Oct 30, 2016
    Posts:
    71
    Hello, my rigidbody2d is not reacting correctly to the applied gravityscale.

    What i wanted to achieve was to apply gravity for a short time to a rigidbody2d. Sadly it somehow goes into the full wrong direction. Iam using Unity2019.4.40f1

    while there are 3 different behaviors without changing any setting.
    What iam doing is setting the rb2d gravity scale to 80. The project has a gravity of (0.0, -9,81). Normally the gravityscale is 0.

    1. When i run into the pit without doing anything before. The player gets sucked into a positive Y Value.
    2. When i open the prefab of the player in the editor, it tries to go up but then the player keeps falling.
    3. When i open the player instance in the scene, the rigidbody acts normally.



    playerCore.rb2d.gravityScale = 80; When animation starts
    playerCore.rb2d.gravityScale = 0; When animation ends.

    Maybe iam missing something?
    Oh yes i was missing something. Turning off "Apply root motion" for the duration of the fall brings the right behavior.

    but honestly this rootmotion thing is making so many things super hard. I guess i dont fully understand what its needed for, i just need it in some animations.

    Thank you for your time, the thread can be closed
     
    Last edited: Sep 16, 2022
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    29,725
    You could also flair it as RESOLVED yourself rather than leaving it BUG. :)