Page 1 of 1

Damaged or deformed objects after collision

Posted: Tue Oct 16, 2007 3:02 pm
by lukeiamyourfather
Long time reader, first time poster. I'm working on some soft body simulations that involve a group of soft body objects falling to the ground. When the objects hit the ground, some of them become deformed and don't return to their original shape. As if it hit the ground so hard it "broke" the springs of the soft body system.

I'm sure in some cases this would be a desirable effect, however this is not one of those situations. The damaged effect can be eliminated by increasing the spring and dampening though the movement of the objects loses the floppy look and acts more like rubber. I'm using the solid option with a star pattern and a relevant resolution for the simulation and geometry.

Has anyone run into this problem before? Is there any way to make the soft body objects not "break" or damage, and always return to their original shape? Any insight would be greatly appreciated!

Damaged or deformed objects after collision

Posted: Tue Oct 16, 2007 3:36 pm
by shaun_michael
Have you tried running the sim at the stiffness you want. Find the frame before which you want to return to the original shape and add another key for the same stiffness value. Go to the next frame and increase the stiffness and keyframe that frame to force the shape back again?

Dont know if this would work in the circumstances you're after but it should return to the original shape. I guess then you could re-keyframe the stiffness back to the original value for subsequent collisions.


Damaged or deformed objects after collision

Posted: Tue Oct 16, 2007 3:56 pm
by lukeiamyourfather
Hmmm, that's not a bad idea. It will require a lot of keys to get everything done, but it would in theory work. I'll give that a try and see what happens. Thanks for the input!

Damaged or deformed objects after collision

Posted: Wed Oct 17, 2007 8:29 pm
by orr
if you are into scripting you could write out a script something like this:

first makeing a NodesPickerDialog for the Object you want to keyframe and then:
looping through all the vertices of your object and checking their distance to the colinding objs vertices. And if a certain distance is reached (collision) just set the stiffness parameter and daping parameter higher ... or getting the parameters curves and setting keyframes for a smooth movement.
Maybe if I have sometime I can wirite out a little script :)

Damaged or deformed objects after collision

Posted: Wed Oct 17, 2007 10:03 pm
by shaun_michael
That'd be pretty useful Orr :)


Damaged or deformed objects after collision

Posted: Thu Oct 18, 2007 7:08 pm
by orr
it's done you could try it if want and tell me if itÄs working right for you .. il'll up it to the nextlimit site soon:

ehh how can I upload scripts here ?

MaxStiffness = The Maximum Stiffness
MaxDamping = The Maximum Stiffness
Distance = the distance between the objects and the solid collision object
SolidObject = the collision Object (eg The ground)
DelayInSeconds = When the distance conditation is met (if the objects verties are in a certain distance to a solidobject). The script will inscrease the stiffnes and damping values .. by adding a delay you can controll in what time the max values are reached
for example if the objet collides at frame 10, your maxstiff is at 30 your delay at 0.5 the maxstiffnes value will start increasing at frame 10 and after 0.5 seconds it's at 30.
for a smoother movement

issues: at the moment to many keys are added i'll fix that before I upload it :)

Code: Select all


# Function: onSimulationBegin 

def onSimulationBegin():
	global objects
	global delay
	global maxstif
	global maxdamp
	global distlimit
	global colobj

	dialog =
	objects = TYPE_OBJECT)

	objsN = []
	for Oname in scene.getObjects():

	form =
	form.addFloatField("DelayInSeconds", 0.0)
	form.addFloatField("MaxStiffness", 30.0)
	form.addFloatField("MaxDamping", 10.0)
	form.addFloatField("Distance", 0.1)
	form.addListField("SolidObject", objsN, 0)

	parametersValid = False
	while ( not parametersValid ):	
			delay = form.getFieldValue("DelayInSeconds")
			maxstif = form.getFieldValue("MaxStiffness")
			maxdamp = form.getFieldValue("MaxDamping")
			distlimit = form.getFieldValue("Distance")
			sobjN = form.getFieldValue("SolidObject")


			colobj = scene.getEmitter(objsN[sobjN] )


		parametersValid = True

# Function: onSimulationStep 

def onSimulationStep():
	global objects
	global delay
	global maxstif
	global maxdamp
	global distlimit
	global colobj

	for obj in objects:
		objverts = obj.getVertices()
		colobjp = colobj.getParameter("Position")
		for vert in objverts:
			vpos = vert.getPosition()

			dist = vpos.distance(colobjp)

			if(dist < distlimit):
				curvestif = obj.getParameterCurve("Stiffness")
				sKey =
				sKey.time = scene.getCurrentTime()
				sKey.value = obj.getParameter("Stiffness")
				sKey.type = KEY_TYPE_LINEAR
				sKey.tcbEaseTo = 0.0
				sKey.tcbEaseFrom = 0.0
				sKey.tcbTension= 0.0
				sKey.tcbContinuity = 0.0
				sKey.tcbBias = 0.0
				curvestif.addKey( sKey )

				s2Key =
				s2Key.time = scene.getCurrentTime() + delay
				s2Key.value = maxstif
				s2Key.type = KEY_TYPE_LINEAR
				s2Key.tcbEaseTo = 0.0
				s2Key.tcbEaseFrom = 0.0
				s2Key.tcbTension= 0.0
				s2Key.tcbContinuity = 0.0
				s2Key.tcbBias = 0.0
				curvestif.addKey( s2Key )

				curvedamp = obj.getParameterCurve("Damping")

				dKey =
				dKey.time = scene.getCurrentTime()
				dKey.value = obj.getParameter("Damping")
				dKey.type = KEY_TYPE_LINEAR
				dKey.tcbEaseTo = 0.0
				dKey.tcbEaseFrom = 0.0
				dKey.tcbTension= 0.0
				dKey.tcbContinuity = 0.0
				dKey.tcbBias = 0.0
				curvedamp.addKey( dKey )

				d2Key =
				d2Key.time = scene.getCurrentTime() + delay
				d2Key.value = maxdamp
				d2Key.type = KEY_TYPE_LINEAR
				d2Key.tcbEaseTo = 0.0
				d2Key.tcbEaseFrom = 0.0
				d2Key.tcbTension= 0.0
				d2Key.tcbContinuity = 0.0
				d2Key.tcbBias = 0.0
				curvedamp.addKey( d2Key )

# Function: onSimulationFrame 

def onSimulationFrame():

# Function: onSimulationEnd 

def onSimulationEnd():

# Function: onChangeToFrame 

def onChangeToFrame():

Damaged or deformed objects after collision

Posted: Mon Oct 22, 2007 3:39 pm
by lukeiamyourfather
Orr, that's an impressive script. I'm working on testing it right now, I'll keep you posted with the progress. Thanks for the very helpful input!

Damaged or deformed objects after collision

Posted: Mon Oct 22, 2007 7:31 pm
by orr
thanks for testing but I think the script isn't working ... because the script only checkts the distance from the softbodys vertices to the centre position of a object.. so if you have a object colliding far away from the centre point of the collisonobj it won't work .. maybe I could work that out.

Damaged or deformed objects after collision

Posted: Fri Feb 22, 2008 11:19 am
by bokeh
okk i think am way too late ... but you could try Ncloth in maya ... it does these kind of things really well.