Hi,
The problem is Locomotion’s performance, when the game runs on a slow machine, I think it gets less computation time than character controller. Then something odd happens. :roll:
You’re running forward and when you want to change your path of running, character model rotates toward that angle bud path of running continues the last same way. So it looks like character is running backward or something like that.
Can I do anything to prevent this? Like a way to raise its priority of execution, or any other advice. Thanks so much in advance.
Hi,
The Locomotion System doesn’t control the overall movement of the character, so this is not related to the Locomotion System as such. You can try to disable the LegAnimator component and see that the problem still appears (only now without animation).
So your problem is that the velocity of the character doesn’t change to match the rotation of the character fast enough - this is most likely not even related to performance. The script you are using to move the character may have some built-in inertia that you can maybe reduce or some max acceleration that you can increase. It’s hard to give more specific advise without knowing the script you use to move the character with but hopefully this can lead you in the right direction.
Note though that the faster your character can change velocity, the more likely the Locomotion Systrem is to produce artifacts / weird looking movement when abruptly changing direction or speed.
You are right but, I didn’t actually change any scripts, and use character controller just like the tut. And besides the same scripts work perfect when scene is not complex, for example if you look at ground and run it’s ok, but if you look up and some building models show up the problem occurs.
The CharacterController doesn’t move on it’s own. I assume you’re using the NormalCharacterMotor script included with the Locomotion System project?
That sounds strange, as the script should be framerate independent. It may become imprecise if the framerate drops way too low though. How low a framerate are we talking about when the problem appears?
Just as a test, does the problem still occur if you set the maxVelocityChange value very high?
Frame rate is 9 or 10 fps. By increasing maxVelocityChange movement gets odd, kinda it’s hitting floor on sudden changes of direction and yes problem does not occur. :?
Let me explain another example of problem, You are running forward for a while, then you release the up (or W) key, but the player still runs forward and speed gets down slowly, 4,5 seconds after releasing up-key, player would stop.
I think there is a bug in the NormalCharacterMotor script so it’s not completely framerate-independent after all. Try changing these lines:
if (velocityChange.magnitude > maxVelocityChange) {
velocityChange = velocityChange.normalized * maxVelocityChange;
}
To these:
if (velocityChange.magnitude > maxVelocityChange * Time.deltaTime) {
velocityChange = velocityChange.normalized * maxVelocityChange * Time.deltaTime;
}
Afterwards you need to tweak the maxVelocityChange value to look good.
Hope that helps.
I changed maxVelocityChange to 20 instead of 0.2, Well it seems nice now, thanks for that! 