Quantcast
Channel: Questions in topic: "level-design"
Viewing all articles
Browse latest Browse all 205

How to create a sine function with cutoff peaks and troughs

$
0
0
I want to create a saw hazard for my current game and I want the arm to move back in forth similar to capturing the output of a sine function like this `movementDistance * Mathf.Sin(counter * movementSpeed);` except I want the "edges" of the sine function to be capped off (compressed) like this ![alt text][1] [1]: /storage/temp/180089-clippedsine.png (original source: https://www.youtube.com/watch?v=yj53Q-pisbw&t=87s&ab_channel=CSGuitars between 0:48 and 0:57) I'm aware I could simply use `Mathf.Clamp(calculatedValue, -extent, extent)` , but this would create drastic stopping and starting at the edges and I'd like to round these edges if possible to make a more realistic slowdown effect for the saw arm. How could I achieve such an effect?

Viewing all articles
Browse latest Browse all 205

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>