Can u help us in simulating a pendulum

what is a pendulum???
i have never heared that word :wink:

ohh sorry i know now.
took a little search in google

What’s a pendulum? A outerspace thing? :-? :smiley:

An apparatus consisting of an object mounted so that it swings freely under the influence of gravity

Imagine a stone on the end of a piece of string swinging, that’s a pendulum.

As for simulating it I’m not too sure. The game engine already has gravity so that’s no problem. To simulate one I’d imagine you need to constrain the swinging object a set distance from a certain point, then give it some sidewards force.

you can make it like an ipo. or you could use an tuhopuu versone i think :wink:

Ahhhh, the majestic motion of the pendulum. A pendulum’s motion should be easy to mimic using ipos (interpolation curves). However if you want to recreat a true pundulum motion then you’ll have to put some extra thought into it.

A simple method would be:

  1. Select your pendulum object, enter ‘edit’ mode (‘tab’ key)

  2. Move your object downwards (constrain your movement by pushing MMB as you move your object) Note that your object’s pivot point (pink dot) should NOT move with your object (if it did then you weren’t in ‘edit’ mode).

  3. The pivot point will become the centre of your object’s pendulum arc. Push ‘tab’ key to exit edit mode. (object will become pink).

  4. In your menu bar push the edit mode button (square with dots) so you can see what frame you’re in (button to far right) You can scroll your menu bar with MMB/drag mouse if you can’t see the frame number button. Anyway it should read ‘1’. Push the ‘down’ arrow if its not.

  5. Select your object and rotate it (‘R’ key) approx 30 degrees clockwise (‘Ctrl’ key constrains rotation). Make sure you were viewing the object in the correct axis (front, right, top etc)

  6. Once your object is in the desired position set it b pushing LMB, and with your mouse arrow in the 3D window, push ‘i’ key and select the ‘LocRot’ option. (This locks the object’s angle of rotation for frame one).

  7. Push ‘up’ arrow 5 times and the frame counter will go to 51 (approx 1 second). Push ‘i’ key again and select the ‘LocRot’ option. (This locks the object’s angle of rotation for frame 51). Note that frame 51 will be the end of your pendulum’s motion and so the pendulum must be in the same place as at frame 1.

  8. Your nearly there. Goto frame 25 using your ‘left’ arrow key. Rotate your object 60 degrees anticlockwise. Push ‘i’ key again and select the ‘LocRot’ option. (This locks the object’s angle of rotation for frame 25).

  9. If you set your frame to 1 and then repetitively push your ‘right’ arrow key you’ll see the motion you created. If you want to view your ipo curve then 'split your 3D window and change from 3D window to ipo window (button looks like a graph).

  10. To view the pendulum’s motion in realtime you’ll have to hook up the logic bricks:

‘always’ sensor -> ‘and’ controller -> "ipo’ actuator (Set up options as: Loop End / Sta = 1 /End = 51)

  1. Push P.

Your pendulum motion will need tweaking - this can be done in the ipo graph window (lots of fun). If you get the motion just right it really adds to the immersive feeling of your game - good luck.

Can we swing an object connected with a string from one place to another without using IPO. The object should get simulated by force, velocity and other physical constraints.

so you are talking about using physics / dynamics for animating - that has been popping up recently, as the game engine is coming back, with physics ( … that’s hopefully the future

but currently, there’s a script for recording IPOs from the game engine, search this forum (GameIPO or something is the name)


Saluk made something like that, search this forum for “tether.”

Yes. Look for Saluk’s post. It is exactly what you have described. The link on the post is defunct. So, you should contact Saluk to get the file.

Here is the link:

I just wanted to say that this was a VERY well written explanation. You went step by step, you did not ASSUme that they reader had knowledge that he/she might not have,AND there were no glaring usage errors.

This is how a tutorial/instruction should be written.

I uploaded my tether script:

unfortunately its really simple, another one of those little things that I started but never finished.

Hey saluk we tried your link but its showing some binary firgures instead of a blend file.
We tried our pendulum but instead of swinging its rotating and not stopping.Whats the solution for this.

nope, that was the .blend file

right click (control+click on mac) on link, and choose save target as (download to disk on mac, similar names other platforms) and save it somewhere.

you may have to do this on other websites too

This Flash tutorial may also help in the simulation of a pendulum. I found it at, in the tutorial section. Maybe you can translate the techniques used in this tutorial to Blender. For instance, the IPO frames in Blender translate to the frames in Flash. The OnEvent code in Flash is similar to the Controller Logic Bricks in Blender…You can find more relationships between the two if you really study how they function. Good luck.

Here is the link:

Saluk u r great. Thanks

Hey Saluk ,we have downloaded your .blend file and it is very good. The tether is swinging properly. But if we add a string to it, it doesnt swing properly as a string should swing. Is there any solution? We want to show a sphere tied to one end of a string and swinging freely.

Saluk , could you please give us the explanation of the code. We are trying to make a pendulum

which is an object swinging to and fro attached to a string. We have tried your program and

have even added a string to the small box but the string is not swinging. please help

My code simulates the position of an object hanging on the end of a string, unfortunately I stopped in the middle of working on this script, so I never added a rotational component to it. If you want the string to just be straight, you can give the string a track-to actuator and put the name of the object on the end of the string. If you put the base of the string at the pivot point, then the front of it should follow along with the object. Get what I mean?

This script really needs an update though hehe.