# Community

t
Thorsten t.kerkhoff

#### Why assign current_velocity to velocity_new in the beginning?

In function calculate_velocity, the variable decleration reads "var velocity_new := current_velocity", just to be replaced in the next line with "velocity_new = move_direction * delta * move_speed", overwriting the value in the first line. Why not "var velocity_new := move_direction * delta * move_speed" in the first line?
• Nathan Lovato replied
Solution

Sure, you can do that. I think it's there because we used to have some acceleration and decceleration on the character, in which case you add or subtract to the current velocity, rather than calculating it from 0 each frame.

• t
Thorsten t.kerkhoff replied

Thank you.

A related question: In the chapters before you made it sound like move_and_slide would handle delta internally, so we shouldn't multiply velocity by delta, and yet we do just that in "calculate_velocity"!?

My movement is also very slow compared to yours [I need to set my max_speed to 500 to make it look as fast as your speed 50.0 in the next chapter]. I thought it would have something to do with that, but removing delta from that equation...

```velocity_new = move_direction * move_speed # * delta
```

...makes the mannequin move way to fast, even at speed 50.

However, that's just a curiosity for me at the moment, I'll do the rest of the course with delta and max_speed 500 :-).﻿

• Nathan Lovato replied

Ah indeed! That's an artefact from when we used move_and_collide, which doesn't apply delta for you. You can remove that delta and scale the values down. Thanks for letting me know - I'll have to keep it as it's in the videos now, but I'll add a note on the lesson and fix the github project.