' Create a sphere with a texture and an XY projection.
CreatePrim "Sphere", "MeshSurface"
CreateProjection "sphere", , siTxtDefaultPlanarXY, , "Texture_Projection"
BlendInTextureLayers , , 1, True, siReplaceAndNoBlendInTextureLayers
SetDisplayMode "Camera", "texturedecal"
' Create a skeleton and envelope it with the sphere.
Create2DSkeleton -4.12810223136029, -2.64625212911425, 0.264625212911426, 0.95263897646775, 3.19920033519785, -0.319920033519786, -5.71059313749964, 0, 0, 4
AppendBone "eff", 5.9143003122372, -3.23869663563226, 0.323869663563226
ApplyFlexEnv "sphere;root,bone,bone1,eff", False, 2
SelectObj "eff", , True
Translate , -4.64411501028021, 0.276474103041814, -2.76474103041813E-02, siRelative, siView, siObj, siXYZ, , , , , , , , , , 2
SaveKey "eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 1
Translate , 5.19982107988636, 0.118488901303611, -1.18488901303611E-02, siRelative, siView, siObj, siXYZ, , , , , , , , , , 2
SaveKey "eff.kine.local.posx,eff.kine.local.posy,eff.kine.local.posz", 80
SetValue "PlayControl.Current", 2
Refresh
SetValue "PlayControl.Current", 1
' Make the UV swim by making the texture projection operator read from the top of the operator stack,
' so that it is applied after the object is enveloped.
SwimUVW "sphere"
MsgBox "The projection is evaluated after the enveloping, so the texture swims on the surface."
SetValue "PlayControl.Current", 50
Refresh
MsgBox "Note that the texture swam on the surface when the bone moved."
' Make the texture stick so that it is no longer affected by the enveloping.
StickUVW "sphere"
MsgBox "StickUVW was called, so the projection is now evaluated before the enveloping. Click OK to see the bone animated."
' Play the animation back: the texture is not affected by the enveloping.
PlayForwardsFromStart |