Be the first to post for 'Mathf.Sin() For Movement Cycles'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

I think I’ve got a simpler way to do the mathf.Sin() bit in lecture 60 & 61. Where would you want me to post it?

Here is fine, thanks!

Anyone noticed this is lecture 60 in section 3, meaning this lecture about circle waves is 3-60?

Hi! I believe there is an error in the formula used for the oscillator. Since we are defining a starting position (as opposed to a minimum position) the formula should give us the starting position at T=0. Right now the resulting initial movementFactor is 0.5 which puts us halfway towards the final position when the scene starts. There are several ways to fix this but one way would be to offset the rawSinWave so that it matches -1 at T=0. Something like this would do the trick:

const float maxAmplitude = Mathf.PI / 2.0f;
float rawSinWave = Mathf.Sin(cycles * tau - maxAmplitude);
movementFactor = (rawSinWave + 1.0f) / 2.0f;

Regards,

Pierre
PS: I’m at lesson 73 and so far all I can say is that your course is very well organized and interesting! Good job!

Privacy & Terms