You need to create an attribute on the actor to track its Y position. make a YActor attribute, and have it Changed to Self.positionY as one of the first behaviors. Then replace the CCC in the other formula with YActor or whatever you call it. That way, you can drop an actor anywhere and it will center its wave motion on that spot.
gyroscopeI am here.Member, Sous Chef, PROPosts: 6,598
i'm sure @Socks won't mind me answering: you mean between 500 and 900 being the height of the wave?
If so, try this: make an integer attribute, let's call it WaveHeight. I'll assume you'll trigger a new spawn every time with a boolean (Let's Call that SpawnGo)
Rule: When SpawnGo is true
Change Attribute SpawnGo to false
Change Attribute WaveHeight to random(500,900)
Constrain Attribute WaveHeight * sin(self.time * 100)+384 -- other figures as example numbers from @Socks--
Comments
Move the actor across the screen to the right however you like, you can use Move, Move To, Interpolate, Accelerate . . . etc.
Then constrain the actor's Y position to: AAA * sin(self.time * BBB)+CCC
AAA = height of the wave.
BBB = pitch of the wave.
CCC = vertical centre point of the wave.
So for example, in a landscape iPad sized project try 200 * sin(self.time * 100)+384
The actor I want a wave motion on spawns randomly between 500 and 900, do I have to take that i consideration when setting my values?
You need to create an attribute on the actor to track its Y position. make a YActor attribute, and have it Changed to Self.positionY as one of the first behaviors. Then replace the CCC in the other formula with YActor or whatever you call it. That way, you can drop an actor anywhere and it will center its wave motion on that spot.
Hi @Boorje75
i'm sure @Socks won't mind me answering: you mean between 500 and 900 being the height of the wave?
If so, try this: make an integer attribute, let's call it WaveHeight. I'll assume you'll trigger a new spawn every time with a boolean (Let's Call that SpawnGo)
Edit: typing while @Tosanu was typing...
Thanks for the help! I figured it out