Clipping values

To clip the value along the boundaries – check if the value goes beyond the specified limits, return the value itself, and if it goes out – the maximum possible boundary value, we can use a very simple function.

Let’s define the clipping function:

In this function, we have set the default bounds from 0 to 1.

For example, if we need to move an object, but not more than within the boundaries of the coordinate area from 0 to 1, we can use this function with default parameters:

Even though we set the Y coordinate to 2, with our clipping function the active object will move to the point with only coordinates (1.0, 1.0, 0.0).

Clipping boundaries can be set in the parameters, if they differ from the default:

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comment
Inline Feedbacks
View all comments