Pendulum Movement Formula?
I have been working with moving objects, in particular Orbiting objects, using the TShirtBooth tutorial for orbits.
I feel like this should be able to be modified, the Cos and Sin formulas, to change a circular orbit into an arc to replicate a pendulum's movement. However, I'm not the best at math, so I am uncertain as to how to do so. Does anyone know a good formula to replicate this motion? (I figure after I get the object's motion down I'll look into making a line object to give the impression of a swinging, if rigid, rope attached to the top)
To clarify, the current formula for a steady orbit allowing for both circular and elliptical versions is:
For Movement.X: Constrain to (Attribute representing X Axis of circle or Ellipse)*cos(self.time *(orbital speed attribute))%360+(centerpoint X position Attribute)
For Movement.Y: Constrain to (Attribute representing Y Axis of circle or Ellipse)*sin(self.time *(orbital speed attribute))%360+(centerpoint Y position Attribute)
Comments
Try this:
Add a self.clockwise(boolean)
Rule: If self.clockwise is true:
rotate clockwise.
Otherwise: rotate counterclockwise.
Rule: If self.rotation = 45
Change attribute self.clockwise to true
Rule: If self.rotation = 315
change attribute self.clockwise to false
Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!
That may help whatever I end up constraining to the object as a rope, but I actually want the object to move in a large arching path, rather than just rotating in place. If i make it all one object it will create a very large invisible zone in the PNG which will make collisions problematic, unfortunately.
Sure Sure, I didn't think about that sorry, I'll have to have a little play around, i'll get back to you if I have some luck
Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!
@RThurman Is that a Windows Creator compatable file? I cant find the project file to open it....
Here is an old example from long ago threads!
http://www.mediafire.com/download/e3zg477cekl764j/simplePendulum.zip
You don't need the '%360' part, you will be good just using . . .
A * cos(self.time * B )+C
A * sin(self.time * B )+C
@Tosanu -- it is a mac file. I just downloaded it and tested it. It opens in GS (Mac) just fine. It is a .zip file. It does need to be uncompressed first.
Unfortunately, I'm using PC. I dont think I can open it in PC, unless I am missing something as to how to do so.
Hmmm... perhaps it was so old that it wouldn't convert properly. I've saved it with the latest mac version. Try to open this version.
whistle Thats a fair number of quick behaviors compared to the orbiting, I think I might be underestimating the complexity of this movement. What behaviors would need to be altered to make it a regular sweep rather than a gravity controlled slowing down motion, would you say?
Nevermind, found the .99 multiplication to remove. Hmmm, I wonder If this is able to be condensed at all.
The 'bob' can be condensed into just two constrain attribute behaviors. But hey will have some monster equations!
The purpose of this demo was to show in detail all the pieces and parts that are needed to mimic a pendulum. Its more of a learning thing to show what needs to be taken into account if one wants to mimic velocity, acceleration, and the effects of gravity.
Do you really want a pendulum that needs to mimic gravity? Or do you simply need an object that sweeps left and right in a half arc? The more exact your description -- the better!
Its the second, the static half arc. The three actor example you put up is great, though, it allows for making an excellent . I have two separate game ideas I need to use it for. The first would have it as a static obstacle. The second would have it as a "swing rope" type action for the player. I intend to have the player swing steadily when attached so any more complex rope movement won't be required.
@Tosanu -- glad you can find the pendulum simulation useful.
Instead of that, if you want an animation of an actor going in an arc you can try the attached file. It is a variation of the recommendation @Socks was making.