Actor motion in a scene.
![dhouse](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
Say I have an actor that I want to translate in a "wavy" motion across a scene.
Simular to the curve below:
http://www.agavegroup.com/?p=68
How should I approach this? The actor needs to move to various positions yet have a smooth bezier-type motion.
Any suggestions would be much appreciated.
Thanks.
-David H.
Simular to the curve below:
http://www.agavegroup.com/?p=68
How should I approach this? The actor needs to move to various positions yet have a smooth bezier-type motion.
Any suggestions would be much appreciated.
Thanks.
-David H.
Best Answer
-
Asymptoteell Posts: 1,362
You're probably going to want to use Sin/Cos curves.
Make an attribute that goes up by a certain number, start with 180, every second. Then, constrain your actor's position Y to "sin(Attribute)*x+y"
The X number should be how high up and down you want the actor to move. The Y should be starting Y position.
Then just have it move left to right at a constant speed using move, interpolate, accelerate, or constrain attribute self.motion.linear.x. It's your choice how you want to move it.
The resulting movement from the combination of these 2 things should be something like what you want.
If this doesn't work to your liking, play around with the speed, the x and y's, and even add a constant number to multiply the attribute by, like "sin(50*self.timing)". This number will change the left to right length of the curve I think, much like adjusting the speed at which the attribute moves up (180).
If you can't get it to work, or if I didn't explain that clearly, just let me know. I'll try to help.
Answers
-David H.