Physics Spikes in 5.2

Hi,

I have been trying out Unity 5.2 and I’ve noticed that I’m getting spikes from the physics processing that causes a moving object to stutter/jump.

The basic scene setup is:

  • A Plane that has been marked as static
  • A Cube that has a box collider, rigidbody and a script to move it

When I move the cube using the keyboard it jumps/stutter as it moves and I get big spikes on the physics side when this happens. I have tried this with the cube sitting on the plane, just above it and with the plane completely disabled, but the problem continues.

I have attached screenshots which show the spikes in the profiler and the components attached to the cube.

This is the movement code:

public class Movement : MonoBehaviour
{
  public float MoveSpeed = 4.5f;
  private Rigidbody _rigidbody;

  private void Awake()
  {
      _rigidbody = GetComponent<Rigidbody>();
  }

  private void FixedUpdate()
  {
      Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
      _rigidbody.position += input * MoveSpeed * Time.fixedDeltaTime;
      _rigidbody.rotation = Quaternion.LookRotation(Vector3.RotateTowards(this.transform.forward, new Vector3(input.x, 0f, input.z), 6f * Time.fixedDeltaTime, 0f));
  }
}

I am currently running Unity 5.2, an AMD HD7850 graphics card and Windows 10 x64.I never ran into this issues with 4.x or previous 5.x, so I’m unsure as to whether I’m missing something, whether it’s a Windows 10 issue or maybe a 5.2 issue.

Has anyone else encountered a similar issue?


2299481--154800--Screenshot2.jpg

Has anyone else experienced a problem similar to this?

I have upgraded from 5.2.1 to 5.2.1p1 and p2 and the problem still remains. I have just tried again, on 5.2, with a single cube and the move script and the issues is still the same.

I read somewhere that it is possible for the physics simulation to run multiple times to catch up with the frame rate, so I changed the physics time to 0.0166 as my monitor is running at 60hz, but this did not appear have any effect.

It is at the point where it is extremely difficult to test anything as characters are always stuttering as they move.

I do not have this problem.

I recreated your scene and the only spikes I get are from Gfx.WaitForPresent.

Tested on 5.2.1p3 and 5.1.4. (win10 64bit, ati/amd 5870 catalyst 15.20)

@elias_t Can you tell me what graphics card/OS/CPU you have, so I can compare to my PC? I’m trying to work out if it is a Unity issue or a issue with my hardware/setup. The thing is never had this issue when using Unity 5.0, but that was back on Windows 8.1.

( Intel Core2 Quad Q6600 @ 2.40GHz, 4gb Ram, win10 64bit, ati/amd 5870 catalyst 15.20)

Thanks. The only real different is the CPU & memory. I’m running an AMD Phenom II X6 1055T (2.8GHz) and 8GB RAM.

UPDATE #1: I’ve attached a two screenshots outlining the issue on 5.2.1p3 and the sample described in the original post.


I am facing this issue on Android! Getting a nasty spike! Have 0 colliders and rigidbodies in the scene.