|
www.blender.nl this document is online at http://www.blender.nl/showitem.php?id=118 |
|
|
||
| Python Roller | ![]() |
2001 01 03
|
||
|
Bart Veldhuizen
|
id118
|
|||
|
![]() |
| How to use the script | ||
|
If you want to use this script download it below and please note the following:
- The script does not work correctly in Blender 2.10 beta yet. - For each object, you have to create an accompanying empty. The empty's name must have the extention '.old'. For example, if your sphere is called 'Sphere', the empty must be called 'Sphere.old'. The script uses this empty to store the location of the sphere in the previous frame. In this way, Blender can calculate the displacement of the sphere since the last frame. Don't worry about the location of the empty - it will be automatically corrected by the script. The sphere's name is automagically fetched by the script. Next, select your sphere and go to the Script Buttons menu. Click on the 'Display Object script links' button in the header - this is the icon with the three arrows. Click on 'New' and change the script event to 'Redraw'. Enter the script's name in the text box. As a last step, check the definition of the radius in line 11 of the script and make sure that it matches the radius of your sphere. If they don't match your sphere will slip while rolling. Now you're ready to go! Switch to top view and drag the sphere around - the rotation will now be automatically calculated. Enjoy B@rt
|
| A bit of theory - Gimbal Lock |
|
Gimbal Lock (quoted from gamedev.net - see below)
As rotations in the Euler representation are done with respect to the global axis, a rotation in one axis could 'override' a rotation in another, making you lose a degree of freedom. This is gimbal lock. Say, if the rotation in the Y axis rotates a vector (parallel to the x axis) so that the vector is parallel to the z axis. Then, any rotations in the z axis would have no effect on the vector. |
| Quaternions |
|
More information about quaternions can be found here:
Gamedev.net
For the mathematically oriented: UC Berkeley college notes |
| Feedback |
|
|
2001 09 29 |
|
|
|
|
|
2001 09 29 |
|
|
|
|
|
2001 09 29 |
|
|
|
|
|
2001 09 29 |
|
|
|
|
|
2001 09 29 |
|
|
|
|
|
2001 01 08 |
|
|
|
|
|
2001 01 06 |
|
|
|
|
|
2001 01 06 |
|
|
|
|
|
2001 01 04 |
|
|
|
|
|
2001 01 04 |
|
|
|
|
|
2001 01 03 |
|
|
|
|
|
2001 01 03 |
|
|
|
|
|
2001 01 03 |
|
Marvellous !!!!!! |
|
|
|
2001 01 03 |
|
|
|