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. Dismiss Notice

Bug Physics completely broken on new Unity URP 2021.3.6f1 project?

Discussion in 'Physics' started by zevonbiebelbrott, Jan 15, 2023.

  1. zevonbiebelbrott

    zevonbiebelbrott

    Joined:
    Feb 14, 2021
    Posts:
    103
    I have no idea whats going on here, the rigidbody is NOT set to Kinematic, for this test Gravity is ON.
    Step1. Create a Capsule in Hierarchy. (It comes with a capsule collider, filter and renderer)
    Step2. Add Component Rigidbody to newly created Capsule.
    Step3. Set new Capsule position.y in Inspector to 50.
    Step4. Press Play
    Step5. Watch as the capsule just stays stuck in the air and doesnt fall.

    There is no scripts, no other objects in the scene. Its a completely fresh Unity URP Project.
    It is working fine in another URP 2021.3.6 project of mine, but today I started a new project and its broken.

    Might be noteworthy that in both 2021.3.6 projects I had to start the project using the URP 2D Template as there is a known bug where the 3D URP Template doesnt show up. What I do then is as soon as the fresh 2d project is loaded I delete the 2D renderer and create a new 3D renderer asset + change options in Project Settings. That works fine as a fix and projects should now be 3D URP.

    However thats the only thing I can think of that could soemhow affect 3D physics? Maybe Unity still thinks we are supposed to be using 2D only due to how the project was setup via the 2D URP Template?

    Its also worth mentioning I could initially not get the rigidbody to move with input, even though its rigidbody.velocity is debugging as having a high value( up to 1600) more than enough to move the rigidbody, however it would just be stuck in place and not move, so I removed all scripts and just wanted to test if gravity worked on my gameObject, it didnt.
    Then I tried the simplest approach: Just one new capsule, and add the rigidbody with no scripts. Still no luck.

    Now we are here...

    Any insight or ideas what could be causing this?

    Thank you
     
  2. zevonbiebelbrott

    zevonbiebelbrott

    Joined:
    Feb 14, 2021
    Posts:
    103
    whyRB.png whyRB.png
    Image above is the old gameobject, with high velocity due to script but no movement in playmode at all.

    capsule.png
    This is the latest, and simplest test, screenshot taken after about 10 seconds inside Play Mode, as you can see Gravity = true but the capsule is still stuck at Y=50 position...

    EDIT: Timestep is 50fps, so 0.02 in Time Settings. Also when using a script to update the rigidbody velocity as in my intial try, the rigidbody.velocity did increase, as seen in the first screenshot, but the rigidbody never moved, even with velocity of 1700, anyway I want to add this, to say I dont think its a timestep issue either.
     
  3. RogDolos

    RogDolos

    Joined:
    Oct 16, 2012
    Posts:
    42
    I'm having this same problem with a project now (on Unity 2022.2.4f). I can make a new clean scene (URP template), add just a plane & a sphere in the air, attach a rigidbody and it won't fall. Physics isn't working at all. What's odd is that in a previous scene I had saved, that's the only scene where physics does work within (yet oddly I have input events not firing there and I've not touched those scripts in a long while).

    Things I had done right before noticing it had broken: Create some prefabs + import a scene from a previous project (via drag & drop, previous version of Unity). None of my project settings had changed in awhile, times are all correct, etc.. Settings wouldn't account for why (some) things work in an older scene, but fresh clean scenes do not...

    I've tried removing the library files and reimporting, didn't work. I tried creating a fresh project on 2022.2.4f and physics works there fine. So my project is somehow borked. I think I'm going to have to carefully restart & reimport this project one thing at a time to fix it.

    Totally baffled.
     
  4. zevonbiebelbrott

    zevonbiebelbrott

    Joined:
    Feb 14, 2021
    Posts:
    103
    Yep, somehow it breaks the project, but starting a completely new Project usually fixes it, its weird that its now also happening in 2022 version though as I experienced this on 2021.3.
     
  5. Sluggy

    Sluggy

    Joined:
    Nov 27, 2012
    Posts:
    841
    Check your project settings and make sure Unity is automatically stepping the physics. go to Project Settings -> Physics -> Simulation Mode and be sure that it is set to FixedUpdate. It might have somehow been switched to manual when importing some other settings?
     
  6. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,533
    Just for the record, "templates" just provide a way to give you assets, packages and global initial settings. There's no such thing as 2D mode or 3D mode. Both physics engines are there unless you disable their modules in the package manager.

    The only thing that would stop 2D/3D physics from simulating, assuming their modules are enabled, would be from the advice above where the simulation mode has been set to "Script" i.e. manual simulation.