plugin/script for "bouncing" (deforming)?

Hello!

This is a gravity script, that reflects meshes that bounce against z = 0.

011:  from Blender import *
012:
013:  time = Get(Const.BP_CURTIME) - 1.0
014:  ob = link
015:
016:  if (time == 0.0):
017:    try:    # existiert schon ein init-Wert fuer das Objekt "ob" ?
018:      if(init.has_key(ob.name)):
019:        ob.LocX = init[ob.name][0]
020:        ob.LocY = init[ob.name][1]
021:        ob.LocZ = init[ob.name][2]
022:        ob.dLocZ = 0.0
023:      else: # wenn nicht, dann setzen:
024:        init[ob.name] = [ob.LocX, ob.LocY, ob.LocZ]
025:    except: # falls das init-dictionary noch gar nicht existiert
026:      init = {}
027:      otime = {}
028:      init[ob.name] = [ob.LocX, ob.LocY, ob.LocZ]
029:  else:
030:    dt = time - otime[ob.name]
031:    if (dt != 0):
032:      ob.LocZ = ob.LocZ + ob.dLocZ * dt
033:      ob.dLocZ = ob.dLocZ - g * dt
034:      if (ob.LocZ < 0.0):
035:        ob.LocZ = 0.0
036:        ob.dLocZ = - elast * ob.dLocZ
037:        if (abs(ob.dLocZ) < threshold):
038:          ob.dLocZ = 0.0
039:  otime[ob.name] = time

Is there a way to deform the Meshes in a physically correct way? Like for example a football bouncing on the ground. I am sure you could do this with latrices (there is little documentation on that) for every single mesh, but is there a script that automatizes this?

Is there a way to effect Lattices (resp. their vertices) in Python? They can not be accessed via NMesh.GetRaw and there is no module called “Lattice” …

ok, i tried: It is very badly programmed. Maybe you could have a look at this. especially the moment of the collision (frame 12) is somehow weird.

Thank you,
Darchethiel.

No lattice access with Python (yet), sorry. I didn’t look at your script, but do a search on the forum for “Dynamica”, it might be what you need (physical correct deformation).

Hope that helps

hmmm dynamica. isnt this a plugin dealing with particle emitters?

Not sure, but one goal of Dynamica was Soft/Rigid Body Dynamics (IIRC). Not sure if it has been implemented. Give it a try.
I downloaded your file: You don’t need a lattice, just change the sizeXYZ of your ball-OBJECT (!) as you do with the lattice. Otherwise it looks good. (Not really phisycal correct, because a bouncing football gets a drop-like shape, but who cares ??)

I thank you for that laud! It really looks a bit strange, but I think i will work on the script, maybe it will get me somewhere with the python-api.
i downloaded dynamica (the publicrelease.zip). But the interface only talks of particles and physical effects (for example gravity and sources of gravity), that concern the particles. I do not find an element that deals with meshes and their deformation.

the material that is released only deals with particles and their physics.

Martin

But on http://www.centralsource.com/blender/dynamica/ one can find the avi “RigidBod test.avi”. This looks really interesting! Is that possible with the current public release?

nope, this is only a test and was never fully developped.

Martin

Speaking of deformation: has anyone ever tried the ‘flex modifier’ in 3DS MAX? That sort of thing would be something to put some coding effort towards. As far as MAX goes, that was really the only thing I really liked about it :stuck_out_tongue:

I don’t think I would be able to pull it off, but maybe someone with lots of expertice and some free time to kill…