[Bf-python] problem with absolute vertex coords
Melchior FRANZ
mfranz at aon.at
Thu Feb 3 01:08:02 CET 2005
I wrote a Python script[1] that outputs vertex coordinates to an xml file that I
can directly use for FlightGear[2] animations. But it turned out that the coords
aren't correct -- they are too big. What I do is basically this:
objects = Blender.Object.GetSelected()
object = objects[0]
mesh = object.getData()
(cx, cy, cz) = object.getLocation()
for v in mesh.verts:
print cx + v[0], cy + v[1], cz + v[2]
whereby the "location" seems to be correct, but the vertex coordinates aren't.
I verified this by moving the cursor to one vertex and comparing the cursor
coordinates (Blender.Window.GetCursorPos()) with the sum of vertex and
location. Is there something else I have to consider? A value that I have to
multiply with each vertex coordinate? The error increases with the distance
from the object center -- it's not constant.
Example:
location: -0.0286820754409 -8.83874573532e-09 49.741859436 (probably correct)
vertex: 3.99657440186 2.29797101021 74.6931228638 (seems wrong)
sum: 3.9678923264191 2.29797100137 124.4349822998 (wrong)
----------------------------------------------------------------
cursor: 3.55405831337 2.06002259254 116.700714111 (right)
m.
[1] I'm a Python beginner, so don't expect too much:
http://members.aon.at/mfranz/fgfs_translate.py :-)
[2] http://www.flightgear.org/
More information about the Bf-python
mailing list