Jump to content
  • Advertisement
Sign in to follow this  
adder_noir

step functions! What are they?

This topic is 2829 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

I've been tinkering around with animations and stuff just generally learning how to program. I've got a while to wait before I can buy Frank Luna's book so I thought I'd get some work in early and teach myself a bit more about code and animation.

I hear alot about a step function. What exactly is this and what's it for? How does it relate to framereates and the like? Thanks ;o)

Share this post


Link to post
Share on other sites
Advertisement
Easy: output is 0.0 (or some other value) below a certain input value, and 1.0 (or some other value) for all input values above a certain threshold. That's it.

In code:
float step(float input) { return (input < 0.5f) ? 0.0f : 1.0f; }

(Of course you can in principle do a step function with integers too, all that matters is that it's one value below and another value above some threshold.)

I'm not sure what step functions are good for in animations, since actually you want animations to be as smooth as possible, which is the opposite of "step".

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!