mCloth deformation meshes

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 11 November 2013   #1
mCloth deformation meshes

This script is a wip. The main goal behind this script was to be able to generate a sphere for each vert of a vert deforming mesh, such as skinned objects. This script then allows users to make the spheres collision objects for mCloth in 3ds Max. If your wondering why I'm doing this, its because currently in 3ds Max users can not simulate cloth on a deforming character using mCloth.


delete objects

--Scene Setup
defMesh = convertToPoly (box width:20 height:80 length:40 widthSegs:4 heightSegs:16 lengthSegs:8 xray:true)
addmodifier defMesh (bend())
animationrange = interval 0f 40f	
animate on 
(
	at time 10 (defMesh.modifiers[1].bendAngle = -120)
	at time 30 (defMesh.modifiers[1].bendAngle = 120)	
	at time 40 (defMesh.modifiers[1].bendAngle = 0)
)

--MAIN SCRIPT
colliderSize = 2.0
colliders = for v = 1 to defMesh.NumVerts collect (sphere radius:colliderSize segments:8 wirecolor:yellow) --generate all needed collider spheres
colliderOffset = -1.0 --spher offset from surface of defMesh

fn GetVertNormal obj vert =
(
	vertFaces = polyOp.getFacesUsingVert obj vert
	tNormal = [0,0,0]
	for i in vertFaces do tNormal += polyOp.getFaceNormal obj i
	tNormal / vertFaces.numberSet
	return tNormal
)

for t = animationrange.start to animationrange.end do
(
	animate on
	at time t
	(
		for v = 1 to defMesh.numVerts do
		(
			vertNormal = GetVertNormal defMesh v
			vertPos = polyop.getVert defMesh v
			offset = vertPos + (vertNormal * colliderOffset)
			
			colliders[v].pos = offset
		)
	)
)
__________________
____________ ___ __ _
John A. Martini
JokerMartini@hotmail.com
www.JokerMartini.com
 
Old 11 November 2013   #2
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 09:27 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.