How do I make an actor move in a horizontal sine wave?
I currently only know how to use the vertical sine wave function where i constrain an actor's y position to, for example, 10sin(self.Time300)+160. This is to move the actor up and down smoothly. However, I cannot figure out how to make the actor move rom left to right in an arcsine wave. I tried constraining its x position to 10asin(self.Time300)+284, but that does nothing I want it to do.
Best Answers
-
Socks London, UK.Posts: 12,822
@EthaneusTheGreat said:
Can you please explain in further detail how to do this is how to use arcsine?Not 100% what this question means ?
@EthaneusTheGreat said:
All I want is the EXACT same movement of a sine wave going up and down, but instead from right to left.Use the equation you have in your first post, but instead of constraining the actor's Y position to that equation, constrain the actor's X position to that equation.
Answers
If you want the actor to move left to right use the Move / Move To / Interpolate or even Accelerate behaviour (although with the Accelerate behaviour the initial pitch of your sine wave will be squashed up before it hits max velocity).
Not what I want, because the move behaviour is not a smooth movement, it remains at a constant speed. The sine wave slows down as it reaches the top and bottom. They are different things.
My Games:
https://itunes.apple.com/us/developer/ethan-sarif-kattan/id825823924
https://play.google.com/store/apps/developer?id=ETG+Ltd.
Website: https://etggames.com
The move behaviour is a smooth movement, that is to say its velocity is constant.
A sin value slows (in its vertical speed) as it reaches 90° and 270° (the 'top' and 'bottom' of its extent), but a sine wave's horizontal movement is perfectly constant, it doesn't slow down or speed up.
Trust me ! Try it !
Constrain the actor's Y position to the sin (or cos) of an ever increasing angle - and use Move / Move To / Interpolate or even Accelerate behaviour to move the actor left to right and you will get a sine wave.
Can you please explain in further detail how to do this is how to use arcsine? All I want is the EXACT same movement of a sine wave going up and down, but instead from right to left
My Games:
https://itunes.apple.com/us/developer/ethan-sarif-kattan/id825823924
https://play.google.com/store/apps/developer?id=ETG+Ltd.
Website: https://etggames.com
I'm pretty sure that doesn't work? Have u tried r is it just a theory?
My Games:
https://itunes.apple.com/us/developer/ethan-sarif-kattan/id825823924
https://play.google.com/store/apps/developer?id=ETG+Ltd.
Website: https://etggames.com
There's no reason it shouldn't work. If it works in one direction, it will work in another. All you're doing is constraining a different attribute to the same value that you've already said works just fine.
Ok, not a lot I can say to that, I can't force you to try it lol, especially if you are sure it doesn't work.
I've tried it and it didn't work. Aren't sine waves for up and down movement only tho?
My Games:
https://itunes.apple.com/us/developer/ethan-sarif-kattan/id825823924
https://play.google.com/store/apps/developer?id=ETG+Ltd.
Website: https://etggames.com
@EthaneusTheGreat what is your ultimate goal? Just to move up and down in a straight line at a constant speed?
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
You must have made a mistake when setting up your rules / behaviours.
'It didn't work' doesn't give any clues as to what the problem might be, it's usually best to describe what did happen (i.e. it went the wrong way, it moved but then stopped, it didn't move at all . . . . etc etc)
Could you post a screenshot of the rule that moves your actor so we can try and see if you've made a mistake anywhere.
No, not at all, sine waves aren't for anything specific, they are a maths function, you can do what you like with them, you can use them to make an actor cycle through the colours of the rainbow or travel in a wiggling, random path, or bounce, or make an actor grow and shrink in size as you tilt your iPad left to right . . . and a million other things.
I think (but not 100% sure) he wants an actor to move left to right.
why not do something like
if position Y = 100
interpolate y to 200 over 1 second at a linear speed (or ease in.out to slow down)
if position y = 200
interpolate y to 100 over 1 second
Send and Receive Data using your own Server Tutorial! | Vote for A Long Way Home on Steam Greenlight! | Ten Years Left
He wants to move left to right (rather than in the Y direction), he's already got the constrain working fine for Y, he just needs the lefthand side of his behaviour to read position.x rather than position.y.
Oh . . . . damn it ! I'll just make a demo to see if that is what he actually wants . . . .
Socks, I love you . I was accidentally using the change attribute instead of contrain (yes.. I know!)
My Games:
https://itunes.apple.com/us/developer/ethan-sarif-kattan/id825823924
https://play.google.com/store/apps/developer?id=ETG+Ltd.
Website: https://etggames.com
I hope it's a manly love, you know, like 'bros', no touching or anything weird.
I've put your name down on 'the list' for that, I can't tell you anything about the list, just that you don't want to be on it.