plugin/script for "bouncing" (deforming)?

(Darchethiel) #1


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

011:  from Blender import *
013:  time = Get(Const.BP_CURTIME) - 1.0
014:  ob = link
016:  if (time == 0.0):
017:    try:    # existiert schon ein init-Wert fuer das Objekt "ob" ?
018:      if(init.has_key(
019:        ob.LocX = init[][0]
020:        ob.LocY = init[][1]
021:        ob.LocZ = init[][2]
022:        ob.dLocZ = 0.0
023:      else: # wenn nicht, dann setzen:
024:        init[] = [ob.LocX, ob.LocY, ob.LocZ]
025:    except: # falls das init-dictionary noch gar nicht existiert
026:      init = {}
027:      otime = {}
028:      init[] = [ob.LocX, ob.LocY, ob.LocZ]
029:  else:
030:    dt = time - otime[]
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[] = 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?

(Darchethiel) #2

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” …

(Darchethiel) #3

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,

(Schlops) #4

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

(Darchethiel) #5

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

(Schlops) #6

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 ??)

(Darchethiel) #7

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 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.

(theeth) #8

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


(Darchethiel) #9

But on one can find the avi “RigidBod test.avi”. This looks really interesting! Is that possible with the current public release?

(theeth) #10

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


(Jamesk) #11

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…