Physics Simulation has stopped completely

Hey all - I feel like I’ve lost my mind today, and I need a bit of help getting it back.
I’ve been working on a game for a while now that is essentially a “charge and release” physics game. The longer you hold the button, the more force gets applied to a rigid body when you release.

The core of this is done here:

float angle = AimController.Angle;
int force = AimController.CurrentCharge;
float wobble = _actor.GetCurrentSkill().RandomWobble;
float finalAngle = angle + wobble;

Vector3 direction = Quaternion.Euler(0, finalAngle, 0) * Vector3.forward;
rb.AddForce(direction.normalized * force, ForceMode.Impulse);

However, today all of my rigid bodies have simply stopped moving in the scene. I can’t stress enough; I have changed no code, no project settings. Nothing. I’ve spent time importing 2d artwork for the GUI and that is all. I’ve reverted my changes, rolled back the branch to a stable commit yesterday I know worked, and yet the rigidbodies still refuse to move.

I’ve created a brand new Unity project and the physics behave as expected there.

I tried to solve the problem by changing the physics simulation method to Script and added a simple gameobject to the scene with method that called Physics.Simulate. I’ve tried every combination of Update, LateUpdate, FixedUpdate, Time.fixedDeltaTime, etc, that I can think of and still nothing.

I’ve just finished re-importing all, and nothing is working. Searching the forums all I can find are topics about slow physics, unoptimised physics, or other cases where physics is misbehaving, rather than not behaving at all.

Printing as many things to the console as I can think of to see if there’s something that comes up, and the most obvious I can see is the discrepancy between the RigidBody.Position and the RigidBody.Transform.Position, but I can’t say for certain if that’s to be expected.

This log comes immediately after the force has been applied.

Force Info:
Force=21
AddedForce=(5.95, 0.00, 20.14)
RB Info taken at Time: 5.556464: 
RB Position=(0.00, 0.00, 0.00), 
Transform Position (-3.00, 1.00, -7.00)
Velocity=(0.00, 0.00, 0.00), 
IsKinematic=False, 
UseGravity=True, 
Constraints=FreezeRotation, 
Sleeping=False
UnityEngine.Debug:Log (object)
GameState_FlickPlayer:StartStage () (at Assets/Game/Scripts/GameStates/GameState_FlickPlayer.cs:55)

Which hidden setting have I somehow triggered that has stopped this from functioning?

Edit to update:
I’ve reduced the scene to just be a flat plane and the rigid body, but the rigidbody doesn’t even fall toward the plane.

Edit with Solution for anyone who is following me:
I’ve tried so many things this evening to solve this problem, methodically isolating and solving each bit, and ultimately the one thing that worked was deleting the Library folder and letting Unity regenerate it. This explains why resetting the repository did nothing to fix it as those are in the standard ignore file, but it does not explain what caused this issue in the first place.

3 Likes