[Bf-python] Extracting cloth vertices position
fmart
fmart at iri.upc.edu
Fri Mar 14 13:49:13 CET 2014
Hello,
I'm trying to obtain all vertices global position of a piece of cloth
after colliding with a table. My simulation starts with a plane as a
piece of cloth and another plane below as a table with the Collision
modifier.
To obtain all the data I need I'm using the following code (I've the
cloth selected):
import bpy
current_obj = bpy.context.active_object
print("="*40) # printing marker
for face in current_obj.data.polygons:
verts_in_face = face.vertices[:]
print("face index", face.index)
print("normal", face.normal)
for vert in verts_in_face:
local_point = current_obj.data.vertices[vert].co
world_point = current_obj.matrix_world * local_point
print("vert", vert, " vert co", world_point)
The simulation works well, I think the code also works well. However,
all that I obtain are vertices global position of the cloth in the
initial position, it doesn't matter whenever I pause the simulation.
Is there any possibility to obtain cloth vertices position after a
collision?
Thanks!
Felip
More information about the Bf-python
mailing list