After a month or so I’ve finally written something that works properly.
CubeCtrl.py:
This module enables tracking of a cube object’s properties.
It provides services to map a cube object’s faces, edges
and vertices into world (or user defined) space regardless
of the cube object’s orientation. However, currently the mapping
services are valid only for orthogonal object orientation matrices, in
other words, fmod(rotation, 90.0) == 0.0 must always be true (ie.
only 90.0 degree rotations).
The coordinates of the cube's mapped properties are in
world space. That is, the mapped right face is X+, front
face is Y+ and top face is Z+. However, one could use
additional transformation matrices to orient the mapped
properties into an different spatial frame of reference.
Essentially, when a cube object rotates 90 degress on any
axis, the map's faces/axii/vertices can be mapped onto the
cube's new orientation. For example, if the cube object
rotates onto its front face (tips over frontwards), then
the map's front face will refer to the cube object's top face,
since the cube object's Z+ axis is now aligned with Y+.
So, if you want to manipulate a cube's top (in world space), you
can now use the mapping services to easily determine which of
the cube object's faces is pointing up (Z+) and then access
its edge's vertex data.
I wrote it for a project that I’m working on.
Download it from http://www3.telus.net/BulletBlender/.
Try it out and post a response. It has a main function with samples for
testing.