tags:

views:

1037

answers:

3

I have a car and when accelerating i want the speed to increse "slowly"..

After looking at a few sites i came to the conclusion that the SmoothStep method could be used to do that?

I pretty much know how to move textures and stuff, so an example where smoothstep is used to increase value in a float or something like that, would be extremely helpful!

Thanks in advance :)

I think it is sad there isnt examples for all the methods in the MSDN library.

+2  A: 

From this documentation it looks like SmoothStep takes 3 arguments - the two values you want to move between and the amount between them which probably needs to be between 0 and 1.
So say you have a float f that increments linearly from 0 to the destination speed over a period of time. instead of using f directly as the speed, using SmoothStep would look like this:

float speed = MathHelper.SmoothStep(0, destSpeed, f/destSpeed);

It really is amazing how bad this documentation is.

shoosh
+6  A: 
Coincoin
A: 

Very useful site i found in the meantime. http://johnnygizmo.blogspot.com/2008/10/xna-series-basic-ai.html

And thanks a lot for the answers! :)

But then what is SmoothStep made to do? Where do i use it instead?

Moulde
When you need to interpolate discreet numbers into real numbers and you need the key points slope to be zero. lets say you wanted your car to start slowly at a precise moment and then slowly stop to a very precise moment, then SmootStep would help you for that.
Coincoin
It could also be very usefull for all sort of animation transitions, such as menus.
Coincoin
if you have examples, please post :)
Moulde