Sin Wave - Floating Objects?

Blitz3D Forums/Blitz3D Programming/Sin Wave - Floating Objects?

Guy Fawkes(Posted 2016) [#1]
Hi all. Can someone please help me fix "Float_Objects ( )" function? I want the shapes to bob slowly up & down on a Sin() wave like Asteroids.

Here's my demo:





Thanks! =)

~GF


RemiD(Posted 2016) [#2]
I can't help since i only know the basics of math.

Not sure i understand what you want, but if you want your meshes to float on water-like waves, there are several examples of 3d waves in the code archives...


Guy Fawkes(Posted 2016) [#3]
no. I said I want them to float slowly up & down like asteroids USING the Sin() wave function.

~GF


RemiD(Posted 2016) [#4]
Asteroids do not float up and down, they rather have a direction, a linearvelocity (translate) and an angularvelocity (rotate)


Guy Fawkes(Posted 2016) [#5]
please.. stop with all the schmuck... I just want these objects to float up and down slowly.

~GF


Flanker(Posted 2016) [#6]
Sin() and Cos() return a value beetween -1 and 1 with an angle beetween 0 and 360. So you need an "angle" for each of your object, that you increment with a speed, then use Sin() or Cos() with that angle, multiplied with the desired amplitude. Example :



Guy Fawkes(Posted 2016) [#7]
Thank you, Flanker! :)

~GF


RemiD(Posted 2016) [#8]
Nice example :)

You can probably achieve the same effect by using a height# variable that you progressively increase or decrease.