Search Unity

character falling over problem

Discussion in 'Scripting' started by Karma1989, Nov 25, 2012.

Thread Status:
Not open for further replies.
  1. Karma1989

    Karma1989

    Joined:
    Oct 16, 2012
    Posts:
    18
    ok so im using a rigidbody for "player" but when walking around "player" keeps falling over like its a ragdoll how do i go about keeping this from happening
     
  2. Leddy

    Leddy

    Joined:
    Nov 25, 2012
    Posts:
    3
    If you select this player of yours and look in the inspector. Under the rigidbody component you'll see a dropdown menu titled "Constraints".

    You want to at least freeze the X and Z rotation. This will keep you character from falling over.
    I usually freeze the Y rotation as well, cause then the rigidbody won't rotate unexpectedly. :)
     
    stibolu20, zheyyya, bazveliz and 35 others like this.
  3. Vanamerax

    Vanamerax

    Joined:
    Jan 12, 2012
    Posts:
    938
    Have you checked the isKinematic option? Use this if you want to control the object via script, but let it interact with physics
     
    KN1GHTM4RE, Lautio, mocci233 and 3 others like this.
  4. Karma1989

    Karma1989

    Joined:
    Oct 16, 2012
    Posts:
    18
    thank you guys :) i was thinkin of using the freeze axis just wasnt sure how :D
     
  5. insanepig96

    insanepig96

    Joined:
    Jul 29, 2013
    Posts:
    1
    i had the same problem with my zombies then i found your coment and omg thank you i love you so much now all i need is a zombie modle
     
  6. Catanonia

    Catanonia

    Joined:
    Feb 25, 2016
    Posts:
    8
    Awesome, was having so many problems with models tipping over and this is a simple fix.
     
  7. EmmanuelAlexanderWhite

    EmmanuelAlexanderWhite

    Joined:
    Aug 31, 2017
    Posts:
    1
    thank you sir, that was my problem, you are great!
     
  8. onemanwolfpack

    onemanwolfpack

    Joined:
    Dec 2, 2017
    Posts:
    3

    Thanks! I was looking for this!
     
  9. talhaadeel53

    talhaadeel53

    Joined:
    Jul 23, 2018
    Posts:
    2
     
  10. talhaadeel53

    talhaadeel53

    Joined:
    Jul 23, 2018
    Posts:
    2
    Thanku so much now its working as i want
     
  11. jrturtle

    jrturtle

    Joined:
    Aug 9, 2018
    Posts:
    15
    mine only has a freeze z?
     
  12. dmitryon

    dmitryon

    Joined:
    Jan 6, 2018
    Posts:
    9
    What if you want to implement an impact falling?

    Let's say your model is badly balances and it tips over if x rotation unlocked. Now, I shoot it with a projectile, and it will only move by impact, but never fall.
     
  13. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,637
    You can change the constraints at any time using code, so in the code that you are using to handle the projectile impact on the enemy you can just turn the constraints off.
     
    dmitryon likes this.
  14. lukasrein97

    lukasrein97

    Joined:
    Mar 19, 2019
    Posts:
    1
    this was a simple fix thanks
     
  15. rijkgaming

    rijkgaming

    Joined:
    Jul 5, 2019
    Posts:
    1
    I did this but now my character can move through colliders on the x axis is there a way to fix this
     
    mcooley5155 likes this.
  16. MyUserNameIsWhat

    MyUserNameIsWhat

    Joined:
    Mar 15, 2020
    Posts:
    3
    hello! good am/pm, I'm am beginner in unity and i have a bit some issue when i check everything under rigidbody X,Y and Z in "Freeze rotation" my jump script wont work and when the "Player" or "Character" collides on a cube it keeps tripping like a "ragdoll" and i don't want it to be like that, Is there way that it will be able to be fix? Thank you
     
    Last edited: Mar 19, 2020
  17. BPPHarv

    BPPHarv

    Joined:
    Jun 9, 2012
    Posts:
    318
    Came here wondering what 23k views was about to find a necro :(
     
  18. kdgalla

    kdgalla

    Joined:
    Mar 15, 2013
    Posts:
    4,637
    If you're having some problem with a script then you should always post a new thread in the scripting forum. Copy your script into the post using the "Insert Code" button at the top of the editor.
     
  19. MyUserNameIsWhat

    MyUserNameIsWhat

    Joined:
    Mar 15, 2020
    Posts:
    3
    Oh okay,Thanks!
     
  20. himansa123

    himansa123

    Joined:
    Jan 28, 2021
    Posts:
    1
    I use photon pun for online game.but photon view script added to player it
    falling down IT do not colide the ground.
     
  21. das1192

    das1192

    Joined:
    Jun 17, 2021
    Posts:
    1
    still a great solution for 2021
     
  22. akk05

    akk05

    Joined:
    Jan 23, 2022
    Posts:
    2
    Yeah, I found that only turning on the Z rotation constraint fixed the ragdoll problem and my character no longer shifted through colliders.
     
  23. theodorezanello

    theodorezanello

    Joined:
    Oct 9, 2021
    Posts:
    1
    Thanks a lot! I also needed to freeze the z rotation and everything worked!
     
  24. ZeHgS

    ZeHgS

    Joined:
    Jun 20, 2015
    Posts:
    117
    It worked! Thanks a lot! Love you!! <3
     
  25. Hunter9233

    Hunter9233

    Joined:
    Nov 4, 2022
    Posts:
    1
    So glad this was an easy fix. Thank you!
     
  26. Clovis99

    Clovis99

    Joined:
    Nov 1, 2022
    Posts:
    1

    MY MAN
    YOU HAVE JUST SOLVED MY ISSUE
    THANKS
     
  27. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,473
    And you have just necroed a 10 year old thread. Even worse, in all caps. o_O
     
Thread Status:
Not open for further replies.