moveSpeed value not coming into effect

I have been working on the time.deltaTime lesson and have managed to create a moving object which I can control. The one area causing some frustration is that I appear to have no control over the movement speed, despite setting moveSpeed at a variety of values both in the Inspector and in the script itself.
Here is the script for reference:


I found the initial default speed of my player to be extremely fast, whereas the presenter had a much slower initial speed.
I have tried adjusting the speed in the Inspector, both during a playtest and outside of it. I have tried removing the script from the player object and reapplying it. I have tried the “reset” in the Inspector. None of these changes appear to matter, the movement speed is always the same and is too fast to be useful.
Part of me wonders whether I just need to scale everything up to deal with it, but the issue would still be that I presently don’t seem to be able to adjust movement speed in any of the ways suggested.

Any suggestions are appreciated.

change to transform.Translate(xValue, 0, zValue);

In the code you have, you’re calculated the values (x & z) with Time.deltaTime, but used the raw value instead.

1 Like

Ah, I’m glad to find this was an oversight on my part. Thanks very much!!

1 Like

Glad it solved your issue.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms