Математика |
--Пример фомирования одежды
fn drawLineBetweenTwoPoints pointA pointB =
(
ss = SplineShape pos:pointA
addNewSpline ss
addKnot ss 1 #corner #line PointA
addKnot ss 1 #corner #line PointB
updateShape ss
ss
)
--1.строим первою кривую из отрезков
newSpline1 = drawLineBetweenTwoPoints [2.8,41,0] [1.67,9.68,0]--1 L1
newSpline2 = drawLineBetweenTwoPoints [1.67,9.68,0] [21.23,9.13,0]--2 L2
newSpline3 = drawLineBetweenTwoPoints [21.23,9.13,0] [21.23,40.8,0]--3 L3
newSpline4 = drawLineBetweenTwoPoints [21.23,40.8,0] [2.8,41,0]--4 L4
--и объединить
addAndWeld $Shape02 $Shape01 0.1 --L2=L2+L1
addAndWeld $Shape02 $Shape03 0.1 --L2=L2+L3
addAndWeld $Shape02 $Shape04 0.1 --L2=L2+L4
--Тем самым получам одну замкнутую кривую L2
--2.строим вторую кривую из отрезков
newSpline1s = drawLineBetweenTwoPoints [-21,41,0] [-21,9.7,0]--1 L5
newSpline2s = drawLineBetweenTwoPoints [-21,9.7,0] [-2.18,9.41,0]--2 L6
newSpline3s = drawLineBetweenTwoPoints [-2.18,9.41,0] [-1.9,41,0]--3 L7
newSpline4s= drawLineBetweenTwoPoints [-1.9,41,0] [-21,41,0]--4 L8
--и объединить
addAndWeld $Shape01 $Shape03 0.1 --L5=L5+L6
addAndWeld $Shape01 $Shape04 0.1 -- L5 =L5+L7
addAndWeld $Shape01 $Shape05 0.1 -- L5 = L5+L8
--Объединям все замкнутые кревые
addAndWeld $Shape01 $Shape02 0.1 --L5 = L5 +L1
--***********************************************************
--здесь начинается шаманство
--***********************************************************
--***********************************************************
--2.Выделяем кривую
select $Shape01 --L5
--3.Перейти Line>Vertex
--Метод топора
max modify mode -- open mod panel
subobjectLevel = 0
modPanel.setCurrentObject $Shape01.baseObject
subobjectLevel = 1
modPanel.setCurrentObject $Shape01.baseObject
-- нужно выделить vertex
select $Shape01
--splineSelect
actionMan.executeAction 0 "40021"
max select all
--5.Нажать Break
--***************************
splineOps.startBreak $Shape01
--.Загрузить Garment_Maker()
max modify mode -- open mod panel
myGarment2=Garment_Maker()
addModifier $Shape01 (myGarment2)
--***********************************************************
--выделяем стороны панелей и делаем швы
--***********************************************************
--***********************************************************
-- Выделяем отрезки L1 и L2
--$Shape01.Garment_Maker.selectSplines #{1,2}--было
$Shape01.Garment_Maker.selectSplines #{5,6} --стало
--***********************************************************
--$Shape01.Garment_Maker.selectSplines #{7}
subobjectLevel = 1
$Shape01.Garment_Maker.ButtonCreateSeam()
-- Выделяем отрезки L4 и L2
$Shape01.Garment_Maker.selectSplines #{3,8}
$Shape01.Garment_Maker.ButtonCreateSeam()
--***********************************************************
--$Shape01.Garment_Maker.createSeamFromSplines 4 7 5
--Все шаманство закончилось и работает
--**************************************************************
--**************************************************************
--Создаем форому тела
----**************************************************** --Здесь размещам тело ----**************************************************** --Girl-Например ----**************************************************** ----****************************************************
select $Shape01
max modify mode -- open mod panel
--***********************************************************
--Размещение панель
--***********************************************************
subobjectLevel = 1
modPanel.setCurrentObject $.modifiers[#Garment_Maker]
subobjectLevel = 2
--Крутим вертим куда хотим панель N1
--$Shape01.modifiers[#garment_maker].getPanelMatrix 1--отображения координат
$Shape01.modifiers[#garment_maker].setPanelMatrix 1 (matrix3 [-1,-1.50996e-007,0] [0,0,1] [-1.50996e-007,1,0] [30.6078,-32.9818,8.06699]) $Shape01.modifiers[#garment_maker].setPanelMatrix 2 (matrix3 [1,0,0] [0,0,1] [0,-1,0] [-11.5141,-47.6608,8.18824])
--**************************************************************
--**************************************************************
--Все работает.Проверено в 3D MAX 9
--**************************************************************
--**************************************************************
--Применить модифекатор Cloth к объекту
--1--
max modify mode -- open mod panel
--select $Shape01 -- Выделяем обьект $Shape01 для трансформации
--deleteModifier $Shape01 (Cloth())
myCloth=Cloth()
addModifier $Shape01 (myCloth) --Применяем модефекатор Cloth()
----------------------------------------------------------
--myCloth.subsample =5
--myCloth.startFrame=10
--myCloth.showTargetState =on
----------------------------------------------------------
--Все параметы устанавливаются по умалчанию.
--1--
--$MyObject.Cloth.numberVertices $MyObject
--<integer>numberVertices <node>node
--Returns the number of vertices in the cloth
--модификация Cloth
$Shape01.Cloth.setObjectType $Shape01 2 true
--$Shape01.Cloth.showObjectProperties()
$Shape01.Cloth.setObjectProperty $Shape01 "bend" 25.0
$Shape01.Cloth.setObjectProperty $Shape01 "bCurve" 0.0
$Shape01.Cloth.setObjectProperty $Shape01 "stretch" 75.0
$Shape01.Cloth.setObjectProperty $Shape01 "shear" 225.0
$Shape01.Cloth.setObjectProperty $Shape01 "density" 0.01
$Shape01.Cloth.setObjectProperty $Shape01 "thickness" 0.2
$Shape01.Cloth.setObjectProperty $Shape01 "repulsion" 2.0
$Shape01.Cloth.setObjectProperty $Shape01 "damping" 0.1
$Shape01.Cloth.setObjectProperty $Shape01 "airres" 0.02
$Shape01.Cloth.setObjectProperty $Shape01 "dynFric" 0.1
$Shape01.Cloth.setObjectProperty $Shape01 "staticFric" 0.5
$Shape01.Cloth.setObjectProperty $Shape01 "selfFric" 0.5
$Shape01.Cloth.setObjectProperty $Shape01 "seamForce" 5000.0
$Shape01.Cloth.setObjectProperty $Shape01 "vScale" 1.0
--$Shape01.Cloth.setObjectProperty $Shape01 "useEdgeSprings" 5
--$Shape01.Cloth.setObjectProperty $Shape01 "useSolidFriction" 5
$Shape01.Cloth.setObjectProperty $Shape01 "offset" 1.0
--добавляйте $Cylinder01 к моделированию
addModifier $Girl (myCloth) --Применяем модефекатор Cloth()
$Girl.Cloth.setObjectType $Girl 1 true
--$Girl.Cloth.simulate true
$Girl.Cloth.setObjectProperty $Girl "offset" 0.6
$Girl.Cloth.simulateLocal 1 50 true
$Girl.Cloth.stopLocalSimulation()
|
|
|