move in a circle
-Timo-
Member Posts: 2,313
how can you move a actor in a prefect circle? I dont want it to rotate I only want to move it in a circle.
can someone help me?
can someone help me?
Comments
Constrain its X position to AAA*sin(self.Time*BBB)+CCC
Constrain its Y position to AAA*cos(self.Time*BBB)+CCC
AAA = radius of circle
BBB = speed of movement
CCC = centre point of the circle
Not nessecerally ! : ) They can be whichever way around you want depending on which direction you want the object to move in and/or where the circle starts.
The best and easiest way to switch direction of it is to have the value within the sine and cosine to decrease towards -∞ if it was increasing or vice versa and increase towards ∞ if it was decreasing.
✮ FREE templates at GSinvention ✮
✮ Available for hire! support@gsinvention.com ✮
I can't see that being a problem, as I've got it above the object starts at '12 O'clock' and moves clockwise, I suspect this is going to be what most people are after rather than an object starting at '3 O'clock' and moving anti-clockwise'.
Also I don't really associate X with sine and Y with cosine, I just see one as being out of phase or offset by 90° - in fact (as I'm more than sure you already know) you don't even need to use both sin and cos to move objects in a circle, one will do the trick just fine, you could just stick the phase offset onto whatever you are using for the angle - in this scenario you only need change between a '-' and a '+' to change direction.
This sort of thing:
Clockwise using only 'sin':
X = AAA*sin( game.Time *BBB)+CCC
Y = AAA*sin( game.Time *BBB+90)+CCC
Counterclockwise using only 'sin':
X = AAA*sin( game.Time *BBB)+CCC
Y = AAA*sin( game.Time *BBB-90)+CCC No way, mine's the bestest ! And I'll fight anyone who says otherwise !
#PedantWars
#SineWars
:P