Difference in physics on different computers?

Hi.

I’ve created a walkthrough for a client and noticed something strange. On my own computer I can walk up stairs without a problem, but when I showed the walkthrough to the client on a different computer, the Character Controller stopped about halfway up. I did some testing and found that I couldn’t walk up any stairs on one computer, but had no problems on another, with the same .exe. I made sure that the conditions were exactly the same (I stood still at the bottom of the stairs and tried to walk up). This is Unity 3.1 and I use the FPS controller.

Is this a known bug?

Anyone from the Unity team? This could be a big issue, not knowing how your walkthroughs work on other computers.

Can you post the code you are using to control the character controller (or at least verify that it doesn’t have any framerate dependencies on the Move function, etc)? Are you using FixedUpdate instead of Update for the character controller code?

I’ll try to post what I can tomorrow, but I only use the FPS controller that comes with Unity. I haven’t made any changes to it and I don’t use FixedUpdate.

How do I verify that the move function doesn’t have any framerate dependencies?

This is probably a stupid question : One of the computers has a graphics card with a dedicated physx chip, the other doesn’t. Could that have anything to do with it?

No dedicated physx chip has no impact as unity does not support PPU / CUDA.

As for framerate dependency: Did you move him in FixedUpdate? (anything physical should always be done in there, not in Update etc)

Ah, I didn’t know that. That could be it then. I’ll try using FixedUpdate instead. Thanks!

…But now that I think about it… since I haven’t made any changes to the prefab and since I don’t control the controller from any other place, could that be it?

Are there any good pages/threads/etc that describe best practices regarding Update/FixedUpdate? Or is it just “if it’s rigidbody, use FixedUpdate” simple?

Normally its: “if it touches physics, its FixedUpdate”, because the physics stuff will be updated along that line at a fixed rate per second (configured and controlled by you), while update is called once per frame (much more often than fixedupdate)

Ok, thanks. The fixed framerate, is this “Fixed Timestep” in the “Time Manager”? If not, where do I set it?

I still don’t understand the difference on different computers, though. It’s just the unity prefab FPS controller walking up stairs, there’s nothing special about them that I can see. I’m still a noob, so it’s probably something here that I have missed. Where else can I look?
I’ve solved it this time by adding a “smooth”, sloped, collision object to the stairs, but I want to understand what’s happening if it happens again in another situation.

Correctly that setting is handling the fixed update rate / physics update rate.

if the code does use the controller.Move and does not multiply by Time.deltaTime, it will add a fixed amount each frame → the more frames the computer can achieve, the faster it moves (Time.deltaTime makes the movement framerate independent and fixes this).

so from that point of view: you could use update combined with Time.deltaTime too

There is a value called ‘step offset’ which controls limits for things such as stairs/sidewalk curbs and such.

However for stairs, most people do what you did and create a sloped collision mesh for them. There is a value you can set on the fps controller to limit that as well, so your char doesn’t start trying to walk up walls and such.

As to why the behavior is different on one machine and not the other I’m at a loss. Unity rolled their own PhysX implementation for osX compatibility. I would have assumed it’s ignoring the card, but if not that could account for some differences.

I have seen reports about the character controller being a tad buggy over the years. You could try searching the forums for previous discussions and see if it sheds some light.

Dreamora: Thanks, a lot of useful stuff.

Quietus: I tried changing all of those settings back and forth and just when I thought I had fixed it, I always found a place I couldn’t climb. :confused:

Thank you all, I’ll check the controller more. I guess I’ll keep at it and come back here if I run into the problem again in a different situation or manage to figure out what’s wrong.