#Trying to make a Sine wave?

1 messages · Page 1 of 1 (latest)

weary sapphire
#

Heya there guys, I'm trying to figure out how to do a Sine wave in Visual. Following a guide this guy has on Youtube, but he is using text to code instead.

I feel like I'm doing what he's done, but my object just flies in a 45 degree angle Northwest

dim parrot
#

You should plug time into F

#

Or

time * pi * 2 if you want a full phase to last 1 second

#

The random 45 degree angle is because you have a seemingly arbitrary value in x. Ignore my rambling if that is indeed there for a reason.

weary sapphire
weary sapphire
#

Hmmm, I have it like this now and it just goes in a straight line for 400 spaces (i dunno why 400), then yo-yo's back 400 spaces

#

The multiply is cause i was trying to make it move slower

dim parrot
#

Whats a space

#

400 units seem unlikely given what i see in that image

weary sapphire
#

I eventually figured it out with help from a friend, apparently I should have multiplied after Sin as well

#

And for whatever reason it was a problem when I had a value in X for that Transform, but is working correctly when i make the X movement its own transform :D

dim parrot
#

The feed into sin is your frequency. Multiply that for a faster rate.

Multiply after that for your amplitude.

#

In code itd be

sin(time * frequency) * amplitude

If that helps

oak void
weary sapphire
oak void
weary sapphire
#

It is an enemy that moves up and down in a wave, similar to Medusa Heads in Castlevania

oak void