LinkDeformWithOri

カテゴリ

アニメーション シェイプ アニメーション

詳細

シェイプ アニメーションが 1 つまたは複数の指定したオブジェクトの向きによって動作するよう、ポーズベースのデフォーメーションをセットアップします。 LinkDeformOri によってポーズベースのデフォメーションがセットアップされ、デフォーム キーが作成されると(ApplyDeformKeyまたはSaveDeformKeyを使用)、選択したオブジェクトの向きによってジオメトリのデフォメーションが決定されます。 結果として得られるデフォーメーションは、N 個のオブジェクトの向きによって定義される N 個の空間のシェイプをスムーズに補間します。 良好な結果が得られるよう、オブジェクトの向きによる空間の間の補間は、クォータニオンを使用して実行されます。

ポーズベースのデフォーメーション(マルチリンク パラメータに基づく)を使用すると、クラスタのシェイプを複数のパラメータに同時にリンクできます。 結果として得られるシェイプは、パラメータによって定義される空間内でスムーズに補間されます。 ポーズベースのデフォーメーションは、筋肉のシェイプをボーンの方向などのパラメータにリンクする場合に特に便利です。

スクリプト構文

oReturn = LinkDeformWithOri( Cluster, Parameter list, [LinkWithOri] );

戻り値

向きがシェイプとリンクしているオブジェクトを持つXSICollectionを含むISIVTCollectionを戻します。

パラメータ

パラメータ タイプ 詳細
Cluster 文字列 今後のデフォーメーションで考慮するクラスタ。

デフォルト値: 現在選択されている値

Parameter list 文字列 シェイプとリンクされる方向を持つオブジェクトのリスト

デフォルト値: シーンで選択した値

LinkWithOri ブール True に設定すると、デフォーメーションが回転にリンクします。

デフォルト値: False

1. VBScript の例

'
' This example demonstrates how to link the deformation of a bicep 
' to the orientation of the forearm
'
NewScene , false
SetValue "Context.constructionmode", siConstructionModeModeling
' First we create a cylinder which will serve as our arm for this example
CreatePrim "Cylinder", "MeshSurface"
SetValue "cylinder.cylinder.height", 10
SetValue "cylinder.polymsh.geom.subdivu", 16
SetValue "cylinder.polymsh.geom.subdivv", 20
' We create a skeleton for the arm bones
Create2DSkeleton -3.89906576296024E-02, 4.97990543735225, 0, -0.896785125480857, 0.897163120567376, 0, 0, 0, 0, 4
AppendBone "eff", -3.89906576296024E-02, -4.92789598108747, 0
ApplyFlexEnv "cylinder;bone,bone1,eff", False
' We create the cluster of points that will model the muscle deformation
CreateCluster "cylinder.pnt[107-114,130-137,153-160,176-183,199-206,222-229,245-252,268-275,291-298]"
SetValue "cylinder.polymsh.cls.Point.Name", "Bicep"
' Next we will link the shape of the muscle to the orientation of the forearm bone
LinkDeformWithOri "cylinder.polymsh.cls.Bicep", "bone1"
' Finally we save a couple of deform keys to define the shape of the muscle at a different arm rotation
' One can repeat this process for other bone orientations
Translate "eff", 3.53515295841729, 4.31678486997636, 0, siRelative, siView, siObj, siXYZ
SetUserPref "3D_TRANSFO_PROPORTIONAL_CHANGED", 1
SetValue "Context.constructionmode", siConstructionModePrimaryShape
Translate "cylinder.pnt[157,158,180,181,203,204,226,227,249,250]", 0.727825609085912, -0.156028368794326, 0, _
        siRelative, siView, siObj, siXYZ
SetValue "cylinder.polymsh.movecomponentproportional.distlimit", 1
SaveDeformKey "cylinder.pnt[157,158,180,181,203,204,226,227,249,250]"
SetValue "Context.constructionmode", siConstructionModeModeling
SetValue "PlayControl.Key", 50
SetValue "PlayControl.Current", 50
SaveKey "eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 50
FirstFrame
Translate "eff", -4.93881663308298, -3.66666666666667, 0, siRelative, siView, siObj, siXYZ
SaveKey "eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 1
PlayForwardsFromStart
' The result is a deformation that is interpolated in the quaternion orientation space of the lower bone.
' One can also link the deformation to the orientation of more than one object.

2. VBScript の例

' 
' The goal of the example is to show the script command
' "LinkDeformOri". 
' Two objects are created; the sphere will be deformed according
' to the orientation of the cone (rotation around Z axis).
' First, an animation will be created on the cone (rotation
' of 90 degrees around Z axis) for playback purpose. 
' A cluster is created with some points of the sphere. 
' The cluster is "linked" for deform with the cone, such that 
' changing the orientation of the cone will deform the sphere.
' Two deformation (i.e. moves) of the points of the cluster are 
' performed at different frames, and each of the deformation acts
' as DeformKey.
' 
NewScene
SetValue "Context.constructionmode", siConstructionModeModeling
SetValue "PlayControl.Out", 40
CreatePrim "Sphere", "NurbsSurface", "MySphere"
CreatePrim "Cone", "NurbsSurface", "MyCone"
' 
' Set key at different frames with different angle
' to create an animation of the cone.
'
SaveKey "MyCone.kine.local.rotz", 1, -90
SaveKey "MyCone.kine.local.rotz", 30, -40
SaveKey "MyCone.kine.local.rotz", 40, 0
' 
' Translate the objects to see clearly the cone and the
' effect on the sphere
'
SelectObj "MySphere", , True
Translate , -3, 0, 0, siAbsolute, siParent, siObj, siX
SelectObj "MyCone", , True
Translate , 6, 0, 0, siAbsolute, siParent, siObj, siX
'
' Create a cluster in the sphere, and create a LinkDeformOri
' with the cone.
'
SetSelFilter "Point"
AddToSelection "MySphere.pnt[(0,6),(7,6),(6,6),(5,6),(4,6),(3,6),(6,5),(1,6),(1,5),(2,6),(7,5),(0,5),(2,5),(5,4),(5,5),(4,5)]" 
CreateCluster 
LinkDeformWithOri "MySphere.surfmsh.cls.Point", "MyCone"
'
' Create the first Deform key at frame 1, with translation of
' points of the cluster
'
SetValue "Context.constructionmode", siConstructionModePrimaryShape
SetValue "PlayControl.Current", 1
Translate "MySphere.pnt[(0,6)]", -1.74522900164809, 0.27627214396616, -0.027627214396616, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(0,5)]", -1.63879153625736, 7.95443183208384E-02, -7.95443183208383E-03, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,6)]", 2.5, 0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,5)]", 2.5, -0.3, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(3,5)]", 2, -1.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(1,5)]", -1.5, -0.4, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(7,6)]", -1.2, 1.26649251503908, -0.2, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(5,6)]", 1.5, 1.53788376826177, -0.2, siRelative, siView, siObj, siXYZ
SelectObj "MySphere.surfmsh.cls.Point"
SaveDeformKey
' Create the second Deform key at frame 30, with translation of
' points of the cluster
SetValue "PlayControl.Current", 30
Translate "MySphere.pnt[(0,6)]", 6.0, -0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(0,5)]", 5.4, 0, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(1,5)]", 4.0, 1.3, -0.13, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,5)]", -5.5, 0.12, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(4,6)]", -6.0, -0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(5,4)]", -1.7, 0.5, 0, siRelative, siView, siObj, siXYZ
Translate "MySphere.pnt[(3,6)]", -2.0, 0, 0, siRelative, siView, siObj, siXYZ
SaveDeformKey "MySphere.surfmsh.cls.Point"
SetValue "Context.constructionmode", siConstructionModeModeling
'
' Playback the animation and see the effect of the rotation
' of the cone on the sphere
'
SetDisplayMode "Camera", "textured"
PlayForwardsFromStart

関連項目

LinkDeform SaveDeformKey ApplyDeformKey