<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body>
<p>Hi,<br /><br />Thank you so much for your help, it was very helpful.</p>
<p> </p>
<p>A 2014-03-14 14:57, Bastien Montagne escrigué:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->Hi,<br /><br /> Yep, this way you’ll only get org data, before any modifier is applied… Since cloth's pointcache data do not seem to be available from Python, the only thing you can do to get cloth cos of vertices is to applies all modifiers, like this e.g.:<br /><br />     # Generate temp mesh from object, with modifiers applied.<br />     tmp_me = <tt class="descname">obj.to_mesh</tt><big>(</big><em>scene</em>, True, '<em>RENDER</em><em></em>')<br /><br />     # Use data from tmp_me...<br /><br />     # And then free it!<br />     <span class="n">bpy</span><span class="o">.</span><span class="n">data</span><span class="o">.</span><span class="n">meshes</span><span class="o">.</span><span class="n">remove</span><span class="p">(tmp_me</span><span class="p">)</span><br /><br /><br />
<div class="moz-cite-prefix">On 14/03/2014 13:49, fmart wrote:</div>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px; width:100%">
<pre>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
_______________________________________________
Bf-python mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Bf-python@blender.org">Bf-python@blender.org</a>
<a class="moz-txt-link-freetext" href="http://lists.blender.org/mailman/listinfo/bf-python">http://lists.blender.org/mailman/listinfo/bf-python</a>

</pre>
</blockquote>
</blockquote>
<p> </p>
<div> </div>
</body></html>