1. You have a bone linked to a dummy.
2. You animate the dummy.
3. You export the bone animation.
Problem:
The bone animation does not seem to be in your FBX file when you test it
in your engine.
Why:
Linking moves the bone, but does not change the position controller value.
Solution:
This script to switch out your regular linking with this controller.
Function ConvertLinkedChildrenToPuppets
LOBA --Linked [Child] Objects array.
--Array of objects to have their link
--Constraint converted to script controller.
SGEO --Script Controller geometry object.
--The geometry object that will house the
--SINGLE script controller responsible for
--Controlling the position of all LOBA objects.
--
--*****************************************************
--More Scripts at: www.ProofOfProgress.BlogSpot.com **
--*****************************************************
--
=(
SCON = Scale_Script(); --Create Empty Scale Script.
--Go through geometry objects and add them to lists of exposed nodes.
--Also, add constants to the script controller that are matrices
--Of the original offset position between parent and child.
for g = 1 to LOBA.count do(
gstring = g as string;
--Add Constant
matrixName = "offsetMatrix" + gstring;
parentMatrix = LOBA[g].Parent.Transform;
childMatrix = LOBA[g].Transform;
offsetMatrix = childMatrix*Inverse(parentMatrix);
matrixValue = offsetMatrix;
SCON.AddConstant matrixName matrixValue
--Add Parent
NodeName = "ParentNo" + gstring;
theNodeObj = LOBA[g].Parent;
SCON.AddNode NodeName theNodeObj;
--Add Child
NodeName = "ChildNo" + gstring;
theNodeObj = LOBA[g];
SCON.AddNode NodeName theNodeObj;
--Un-Parent the arrangement:
LOBA[g].Parent = Undefined;
)--[Next g]
--Must add controller LAST or script code will be erased.
SGEO.Scale.Controller = SCON; --Add script controller to object.
--Create The Script:
script_code = "";
for g = 1 to LOBA.count do(
gg = g as string;
--cs = "childNo" + gg + ".Transform = offsetMatrix" + gg + "*ParentNo" + gg +".Transform;" + "\n";
cs = "childNo" + gg + ".Transform = offsetMatrix" + gg + "*ParentNo" + gg +".Transform;" + "\n";
script_code = script_code +cs;
)--[x]
script_code = script_code + "[1,1,1]" + "\n";
SCON.Script = script_code;
)--[FN:ConvertLinkedChildrenToPuppets]
LOBA = #();
LOBA[1] = $Circle01;
LOBA[2] = $Circle02;
LOBA[3] = $Circle03;
LOBA[4] = $Circle04;
SGEO = $SGEO;
ConvertLinkedChildrenToPuppets LOBA SGEO;
No comments:
Post a Comment