You will need to use Euler's angle if the pendulum is not a sphere,
for example:  when it is a cylinder, then, you can use the following rules to draw it:
1. rotate around z axis by \phi
2. rotate around y axis by -\theta
3. rotate around z axis by \phi

You can check out the following applet.

/htdocs/ntnujava/ejsuser/2/users/ntnu/fkh/pendulum3D3_pkg/pendulum3D3.propertiesFull screen applet or Problem viewing java?Add to exception site list
Press the Alt key and the left mouse button to drag the applet off the browser and onto the desktop. This work is licensed under a Creative Commons Attribution 2.5 Taiwan License
Download EJS jar file(1549.7kB):double click downloaded file to run it. (5 times by 4 users) , Download EJS source (7 times by 4 users) View EJS source