fix a serious bug in collision mode (rigid bodies should have been initialized as kinematic, to prevent any movement, because active rigid bodies are used because of better performance) This never happened to me since I didn't test intersecting objects.. my fault.

thanks again to Gael Rosset for finding a case where this problem showed clearly.
pull/4/head
vilda.novak@gmail.com 2013-11-24 00:55:49 +00:00
rodzic 2cea0b4b49
commit cd90e836eb
2 zmienionych plików z 4 dodań i 3 usunięć

Wyświetl plik

@ -74,13 +74,14 @@ def prepareBulletCollision(o):
bpy.ops.object.convert(target='MESH', keep_original=False)
collisionob=bpy.context.active_object
bpy.ops.rigidbody.object_add(type='ACTIVE')
bpy.ops.rigidbody.object_add(type='ACTIVE')#using active instead of passive because of performance.TODO: check if this works also with 4axis...
collisionob.rigid_body.collision_shape = 'MESH'
collisionob.rigid_body.kinematic=True#268 and 70
collisionob.rigid_body.collision_margin = o.skin*BULLET_SCALE
bpy.ops.transform.resize(value=(BULLET_SCALE, BULLET_SCALE, BULLET_SCALE), constraint_axis=(False, False, False), constraint_orientation='GLOBAL', mirror=False, proportional='DISABLED', proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False, snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0), texture_space=False, release_confirm=False)
collisionob.location=collisionob.location*BULLET_SCALE
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
getCutterBullet(o)
#machine objects scaling up to simulation scale

Wyświetl plik

@ -148,7 +148,7 @@ def numpytoimage(a,iname):
a=a.reshape(d)
a=a.repeat(4)
a[3::4]=1
#i.pixels=a
#i.pixels=a this was 50 percent slower...
i.pixels[:]=a[:]#this gives big speedup!
print('\ntime '+str(time.time()-t))
return i