Away3D 4.0 GoldのボーンアニメーションとAwayPhysicsを連携させる | Photoshop CC Tutorials
下記のサイトにMD5とAwayPhysicsを連携させたデモがありましたが
面白そうだったのでさっそくやってみることにしました。

この方はMD5でされているようですが自分はColladaを使って
独自の方法でやってみようと思います。

$ピック社長のブログ

■ FlashDailyさんのサイト
http://flashdaily.net/post/22247175789/away3d-stuff-from-visualiser-fr

■操作方法
 地面をマウスクリック:ボールを投げる
◆【できあがりはこちらをクリック】(要:FlashPlayer11、ビデオカード等GPU搭載PC)
$ピック社長のブログ

//---------------------------------------------------------------------
// Away3D 4.0 GoldのボーンアニメーションとAwayPhysicsを連携させる方法
//---------------------------------------------------------------------

まずBlenderで下の画像のようにモデルを作成してCollada形式で書き出します。
$ピック社長のブログ

次にAwayPhysicsを使って下の画像のようなものを作成します。
$ピック社長のブログ

そして最後にさきほど作成したColladaのボーンとAwayPhysicsを連携させるのですが
下記のようにボーンに関するデータを格納する配列にAwayPhysicsの剛体クラスの座標変換行列を格納します。
$ピック社長のブログ


プログラムは下記のようになります。
これは完璧なスパゲティコードですが、ある意味読みやすいです。(;^_^ A
Main.as
package {


[SWF(backgroundColor="#000000", frameRate="60", width="600", height="400")]
public class Main extends Sprite
{
[Bindable]
[Embed(source="../embeds/boneTest.dae", mimeType="application/octet-stream")]
private var ColladaData:Class;

// tableTexture
[Embed(source="/../embeds/table.jpg")]
private var tableTex:Class;

//signature swf
[Embed(source="/../embeds/signature.swf", symbol="Signature")]
public var SignatureSwf:Class;

private var _view : View3D;

//light objects
private var light:DirectionalLight;
private var lightPicker:StaticLightPicker;
private var direction:Vector3D;

private var physicsWorld : AWPDynamicsWorld;
private var sphereShape : AWPSphereShape;
private var timeStep : Number = 1.0 / 60;
private var generic6Dof : AWPGeneric6DofConstraint;

public var Body_01 : AWPRigidBody = null;
public var Body_02 : AWPRigidBody = null;
public var Body_03 : AWPRigidBody = null;
public var Body_04 : AWPRigidBody = null;
public var Body_05 : AWPRigidBody = null;
public var Body_06 : AWPRigidBody = null;
public var Body_07 : AWPRigidBody = null;
public var Body_08 : AWPRigidBody = null;
public var Body_09 : AWPRigidBody = null;
public var Body_10 : AWPRigidBody = null;
public var Body_11 : AWPRigidBody = null;
public var Body_12 : AWPRigidBody = null;
public var Body_13 : AWPRigidBody = null;
public var Body_14 : AWPRigidBody = null;
public var Body_15 : AWPRigidBody = null;

//signature variables
private var Signature:Sprite;
private var SignatureBitmap:Bitmap;

private var debugDraw:AWPDebugDraw;

public function Main() {
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}

private function init(e : Event = null) : void
{
removeEventListener(Event.ADDED_TO_STAGE, init);

//add signature
Signature = Sprite(new SignatureSwf());
SignatureBitmap = new Bitmap(new BitmapData(Signature.width, Signature.height, true, 0));
stage.quality = StageQuality.HIGH;
SignatureBitmap.bitmapData.draw(Signature);
stage.quality = StageQuality.LOW;
addChild(SignatureBitmap);
SignatureBitmap.y = stage.stageHeight - Signature.height;

_view = new View3D();
this.addChild(_view);
this.addChild(new AwayStats(_view));

//setup the lights for the scene
light = new DirectionalLight( 1, -1, 1);
light.ambient = 0.4;
light.color = 0xffffff;

lightPicker = new StaticLightPicker([light]);
_view.scene.addChild(light);

_view.camera.lens.far = 10000;
_view.camera.y = 2000;
_view.camera.z = -2000;
_view.camera.rotationX = 25;

// init the physics world
physicsWorld = AWPDynamicsWorld.getInstance();
physicsWorld.initWithDbvtBroadphase();

debugDraw = new AWPDebugDraw(_view, physicsWorld);
debugDraw.debugMode |= AWPDebugDraw.DBG_DrawConstraints | AWPDebugDraw.DBG_DrawConstraintLimits;

// create ground mesh
var matground : TextureMaterial = new TextureMaterial(Cast.bitmapTexture(tableTex));
matground.shadowMethod = new FilteredShadowMapMethod(light);
matground.lightPicker = lightPicker;
var ground : Mesh = new Mesh(new PlaneGeometry(7000, 5000),matground);
ground.mouseEnabled = true;
ground.addEventListener(MouseEvent3D.MOUSE_UP, onMouseUp);
_view.scene.addChild(ground);

// create ground shape and rigidbody
var groundShape : AWPStaticPlaneShape = new AWPStaticPlaneShape(new Vector3D(0, 1, 0));
var groundRigidbody : AWPRigidBody = new AWPRigidBody(groundShape, ground, 0);
physicsWorld.addRigidBody(groundRigidbody);

// create rigidbody shapes
sphereShape = new AWPSphereShape(100);

// create a chain with AWPPoint2PointConstraint and box shape;
var boxShape_01 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_02 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_03 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_04 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_05 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_06 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_07 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_08 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_09 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_10 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_11 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_12 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_13 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_14 : AWPBoxShape = new AWPBoxShape(200, 200, 200);
var boxShape_15 : AWPBoxShape = new AWPBoxShape(200, 200, 200);

var p2p_01 : AWPPoint2PointConstraint;
var coneTwist_01 : AWPConeTwistConstraint;
var coneTwist_02 : AWPConeTwistConstraint;
var coneTwist_03 : AWPConeTwistConstraint;
var coneTwist_04 : AWPConeTwistConstraint;
var coneTwist_05 : AWPConeTwistConstraint;
var coneTwist_06 : AWPConeTwistConstraint;
var coneTwist_07 : AWPConeTwistConstraint;
var coneTwist_08 : AWPConeTwistConstraint;
var coneTwist_09 : AWPConeTwistConstraint;
var coneTwist_10 : AWPConeTwistConstraint;
var coneTwist_11 : AWPConeTwistConstraint;
var coneTwist_12 : AWPConeTwistConstraint;
var coneTwist_13 : AWPConeTwistConstraint;
var coneTwist_14 : AWPConeTwistConstraint;

Body_01 = new AWPRigidBody(boxShape_01, null, 5);
Body_01.position = new Vector3D(0, 200, 0);
physicsWorld.addRigidBody(Body_01);

Body_02 = new AWPRigidBody(boxShape_02, null, 5);
Body_02.position = new Vector3D(0, 400, 0);
physicsWorld.addRigidBody(Body_02);

Body_03 = new AWPRigidBody(boxShape_03, null, 5);
Body_03.position = new Vector3D(0, 600, 0);
physicsWorld.addRigidBody(Body_03);

Body_04 = new AWPRigidBody(boxShape_04, null, 5);
Body_04.position = new Vector3D(0, 800, 0);
physicsWorld.addRigidBody(Body_04);

Body_05 = new AWPRigidBody(boxShape_05, null, 5);
Body_05.position = new Vector3D(0, 1000, 0);
physicsWorld.addRigidBody(Body_05);

Body_06 = new AWPRigidBody(boxShape_06, null, 5);
Body_06.position = new Vector3D(0, 1200, 0);
physicsWorld.addRigidBody(Body_06);

Body_07 = new AWPRigidBody(boxShape_07, null, 5);
Body_07.position = new Vector3D(0, 1400, 0);
physicsWorld.addRigidBody(Body_07);

Body_08 = new AWPRigidBody(boxShape_08, null, 5);
Body_08.position = new Vector3D(0, 1600, 0);
physicsWorld.addRigidBody(Body_08);

Body_09 = new AWPRigidBody(boxShape_09, null, 5);
Body_09.position = new Vector3D(0, 1800, 0);
physicsWorld.addRigidBody(Body_09);

Body_10 = new AWPRigidBody(boxShape_10, null, 5);
Body_10.position = new Vector3D(0, 2000, 0);
physicsWorld.addRigidBody(Body_10);

Body_11 = new AWPRigidBody(boxShape_11, null, 5);
Body_11.position = new Vector3D(0, 2200, 0);
physicsWorld.addRigidBody(Body_11);

Body_12 = new AWPRigidBody(boxShape_12, null, 5);
Body_12.position = new Vector3D(0, 2400, 0);
physicsWorld.addRigidBody(Body_12);

Body_13 = new AWPRigidBody(boxShape_13, null, 5);
Body_13.position = new Vector3D(0, 2600, 0);
physicsWorld.addRigidBody(Body_13);

Body_14 = new AWPRigidBody(boxShape_14, null, 5);
Body_14.position = new Vector3D(0, 2800, 0);
physicsWorld.addRigidBody(Body_14);

Body_15 = new AWPRigidBody(boxShape_15, null, 5);
Body_15.position = new Vector3D(0, 3000, 0);
physicsWorld.addRigidBody(Body_15);

//p2p_01 = new AWPPoint2PointConstraint(Body_15, new Vector3D(0, 3200, 0));
//physicsWorld.addConstraint(p2p_01);

coneTwist_01 = new AWPConeTwistConstraint(Body_02, new Vector3D(0, -100, 0), new Vector3D(), Body_01, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_01.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_02 = new AWPConeTwistConstraint(Body_03, new Vector3D(0, -100, 0), new Vector3D(), Body_02, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_02.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_03 = new AWPConeTwistConstraint(Body_04, new Vector3D(0, -100, 0), new Vector3D(), Body_03, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_03.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_04 = new AWPConeTwistConstraint(Body_05, new Vector3D(0, -100, 0), new Vector3D(), Body_04, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_04.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_05 = new AWPConeTwistConstraint(Body_06, new Vector3D(0, -100, 0), new Vector3D(), Body_05, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_05.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_06 = new AWPConeTwistConstraint(Body_07, new Vector3D(0, -100, 0), new Vector3D(), Body_06, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_06.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_07 = new AWPConeTwistConstraint(Body_08, new Vector3D(0, -100, 0), new Vector3D(), Body_07, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_07.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_08 = new AWPConeTwistConstraint(Body_09, new Vector3D(0, -100, 0), new Vector3D(), Body_08, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_08.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_09 = new AWPConeTwistConstraint(Body_10, new Vector3D(0, -100, 0), new Vector3D(), Body_09, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_09.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_10 = new AWPConeTwistConstraint(Body_11, new Vector3D(0, -100, 0), new Vector3D(), Body_10, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_10.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_11 = new AWPConeTwistConstraint(Body_12, new Vector3D(0, -100, 0), new Vector3D(), Body_11, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_11.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_12 = new AWPConeTwistConstraint(Body_13, new Vector3D(0, -100, 0), new Vector3D(), Body_12, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_12.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_13 = new AWPConeTwistConstraint(Body_14, new Vector3D(0, -100, 0), new Vector3D(), Body_13, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_13.setLimit(Math.PI / 3, 0, Math.PI / 3);

coneTwist_14 = new AWPConeTwistConstraint(Body_15, new Vector3D(0, -100, 0), new Vector3D(), Body_14, new Vector3D(0, 100, 0), new Vector3D());
coneTwist_14.setLimit(Math.PI / 3, 0, Math.PI / 3);

physicsWorld.addConstraint(coneTwist_01, true);
physicsWorld.addConstraint(coneTwist_02, true);
physicsWorld.addConstraint(coneTwist_03, true);
physicsWorld.addConstraint(coneTwist_04, true);
physicsWorld.addConstraint(coneTwist_05, true);
physicsWorld.addConstraint(coneTwist_06, true);
physicsWorld.addConstraint(coneTwist_07, true);
physicsWorld.addConstraint(coneTwist_08, true);
physicsWorld.addConstraint(coneTwist_09, true);
physicsWorld.addConstraint(coneTwist_10, true);
physicsWorld.addConstraint(coneTwist_11, true);
physicsWorld.addConstraint(coneTwist_12, true);
physicsWorld.addConstraint(coneTwist_13, true);
physicsWorld.addConstraint(coneTwist_14, true);

stage.addEventListener(Event.ENTER_FRAME, handleEnterFrame);

//Parsers.enableAllBundled();
var context:AssetLoaderContext = new AssetLoaderContext();
AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE, loaded, false, 0, true);
var loader:Loader3D = new Loader3D();
loader.addEventListener(LoaderEvent.RESOURCE_COMPLETE, complete, false, 0, true);
loader.loadData(new ColladaData(), context, null, new DAEParser());
}

private function onTimer(e : TimerEvent) : void {

}

private function onMouseUp(event : MouseEvent3D) : void
{
var pos : Vector3D = _view.camera.position;
var mpos : Vector3D = new Vector3D(event.localPosition.x, event.localPosition.y, event.localPosition.z);

var impulse : Vector3D = mpos.subtract(pos);
impulse.normalize();
impulse.scaleBy(200);

// shoot a sphere
var material : ColorMaterial = new ColorMaterial(0x00BFFF);
material.lightPicker = lightPicker;

var sphere : Mesh = new Mesh(new SphereGeometry(100),material);
_view.scene.addChild(sphere);

var body : AWPRigidBody = new AWPRigidBody(sphereShape, sphere, 2);
body.position = pos;
physicsWorld.addRigidBody(body);

body.applyCentralImpulse(impulse);
}

private function handleEnterFrame(e : Event) : void
{
physicsWorld.step(timeStep);
//debugDraw.debugDrawWorld();

if (animator) {
var scale:int = 100;
var cntIndex:int = 0;

var vec_01:Vector. = new Vector.;
vec_01[0] = Body_01.transform.rawData[0] * scale; vec_01[1] = Body_01.transform.rawData[1] * scale; vec_01[2] = Body_01.transform.rawData[2] * scale; vec_01[3] = Body_01.x;
vec_01[4] = Body_01.transform.rawData[4] * scale; vec_01[5] = Body_01.transform.rawData[5] * scale; vec_01[6] = Body_01.transform.rawData[6] * scale; vec_01[7] = Body_01.y;
vec_01[8] = Body_01.transform.rawData[8] * scale; vec_01[9] = Body_01.transform.rawData[9] * scale; vec_01[10] = Body_01.transform.rawData[10] * scale; vec_01[11] = Body_01.z;

animator.globalMatrices[cntIndex++] = vec_01[0];
animator.globalMatrices[cntIndex++] = vec_01[4];
animator.globalMatrices[cntIndex++] = vec_01[8];
animator.globalMatrices[cntIndex++] = vec_01[3];
animator.globalMatrices[cntIndex++] = vec_01[1];
animator.globalMatrices[cntIndex++] = vec_01[5];
animator.globalMatrices[cntIndex++] = vec_01[9];
animator.globalMatrices[cntIndex++] = vec_01[7];
animator.globalMatrices[cntIndex++] = vec_01[2];
animator.globalMatrices[cntIndex++] = vec_01[6];
animator.globalMatrices[cntIndex++] = vec_01[10];
animator.globalMatrices[cntIndex++] = vec_01[11];

var vec_02:Vector. = new Vector.;
vec_02[0] = Body_02.transform.rawData[0] * scale; vec_02[1] = Body_02.transform.rawData[1] * scale; vec_02[2] = Body_02.transform.rawData[2] * scale; vec_02[3] = Body_02.x;
vec_02[4] = Body_02.transform.rawData[4] * scale/2; vec_02[5] = Body_02.transform.rawData[5] * scale/2; vec_02[6] = Body_02.transform.rawData[6] * scale/2; vec_02[7] = Body_02.y;
vec_02[8] = Body_02.transform.rawData[8] * scale; vec_02[9] = Body_02.transform.rawData[9] * scale; vec_02[10] = Body_02.transform.rawData[10] * scale; vec_02[11] = Body_02.z;

animator.globalMatrices[cntIndex++] = vec_02[0];
animator.globalMatrices[cntIndex++] = vec_02[4];
animator.globalMatrices[cntIndex++] = vec_02[8];
animator.globalMatrices[cntIndex++] = vec_02[3];
animator.globalMatrices[cntIndex++] = vec_02[1];
animator.globalMatrices[cntIndex++] = vec_02[5];
animator.globalMatrices[cntIndex++] = vec_02[9];
animator.globalMatrices[cntIndex++] = vec_02[7];
animator.globalMatrices[cntIndex++] = vec_02[2];
animator.globalMatrices[cntIndex++] = vec_02[6];
animator.globalMatrices[cntIndex++] = vec_02[10];
animator.globalMatrices[cntIndex++] = vec_02[11];

var vec_03:Vector. = new Vector.;
vec_03[0] = Body_03.transform.rawData[0] * scale; vec_03[1] = Body_03.transform.rawData[1] * scale; vec_03[2] = Body_03.transform.rawData[2] * scale; vec_03[3] = Body_03.x;
vec_03[4] = Body_03.transform.rawData[4] * scale/4; vec_03[5] = Body_03.transform.rawData[5] * scale/4; vec_03[6] = Body_03.transform.rawData[6] * scale/4; vec_03[7] = Body_03.y;
vec_03[8] = Body_03.transform.rawData[8] * scale; vec_03[9] = Body_03.transform.rawData[9] * scale; vec_03[10] = Body_03.transform.rawData[10] * scale; vec_03[11] = Body_03.z;

animator.globalMatrices[cntIndex++] = vec_03[0];
animator.globalMatrices[cntIndex++] = vec_03[4];
animator.globalMatrices[cntIndex++] = vec_03[8];
animator.globalMatrices[cntIndex++] = vec_03[3];
animator.globalMatrices[cntIndex++] = vec_03[1];
animator.globalMatrices[cntIndex++] = vec_03[5];
animator.globalMatrices[cntIndex++] = vec_03[9];
animator.globalMatrices[cntIndex++] = vec_03[7];
animator.globalMatrices[cntIndex++] = vec_03[2];
animator.globalMatrices[cntIndex++] = vec_03[6];
animator.globalMatrices[cntIndex++] = vec_03[10];
animator.globalMatrices[cntIndex++] = vec_03[11];

var vec_04:Vector. = new Vector.;
vec_04[0] = Body_04.transform.rawData[0] * scale; vec_04[1] = Body_04.transform.rawData[1] * scale; vec_04[2] = Body_04.transform.rawData[2] * scale; vec_04[3] = Body_04.x;
vec_04[4] = Body_04.transform.rawData[4] * scale/6; vec_04[5] = Body_04.transform.rawData[5] * scale/6; vec_04[6] = Body_04.transform.rawData[6] * scale/6; vec_04[7] = Body_04.y;
vec_04[8] = Body_04.transform.rawData[8] * scale; vec_04[9] = Body_04.transform.rawData[9] * scale; vec_04[10] = Body_04.transform.rawData[10] * scale; vec_04[11] = Body_04.z;

animator.globalMatrices[cntIndex++] = vec_04[0];
animator.globalMatrices[cntIndex++] = vec_04[4];
animator.globalMatrices[cntIndex++] = vec_04[8];
animator.globalMatrices[cntIndex++] = vec_04[3];
animator.globalMatrices[cntIndex++] = vec_04[1];
animator.globalMatrices[cntIndex++] = vec_04[5];
animator.globalMatrices[cntIndex++] = vec_04[9];
animator.globalMatrices[cntIndex++] = vec_04[7];
animator.globalMatrices[cntIndex++] = vec_04[2];
animator.globalMatrices[cntIndex++] = vec_04[6];
animator.globalMatrices[cntIndex++] = vec_04[10];
animator.globalMatrices[cntIndex++] = vec_04[11];

var vec_05:Vector. = new Vector.;
vec_05[0] = Body_05.transform.rawData[0] * scale; vec_05[1] = Body_05.transform.rawData[1] * scale; vec_05[2] = Body_05.transform.rawData[2] * scale; vec_05[3] = Body_05.x;
vec_05[4] = Body_05.transform.rawData[4] * scale/8; vec_05[5] = Body_05.transform.rawData[5] * scale/8; vec_05[6] = Body_05.transform.rawData[6] * scale/8; vec_05[7] = Body_05.y;
vec_05[8] = Body_05.transform.rawData[8] * scale; vec_05[9] = Body_05.transform.rawData[9] * scale; vec_05[10] = Body_05.transform.rawData[10] * scale; vec_05[11] = Body_05.z;

animator.globalMatrices[cntIndex++] = vec_05[0];
animator.globalMatrices[cntIndex++] = vec_05[4];
animator.globalMatrices[cntIndex++] = vec_05[8];
animator.globalMatrices[cntIndex++] = vec_05[3];
animator.globalMatrices[cntIndex++] = vec_05[1];
animator.globalMatrices[cntIndex++] = vec_05[5];
animator.globalMatrices[cntIndex++] = vec_05[9];
animator.globalMatrices[cntIndex++] = vec_05[7];
animator.globalMatrices[cntIndex++] = vec_05[2];
animator.globalMatrices[cntIndex++] = vec_05[6];
animator.globalMatrices[cntIndex++] = vec_05[10];
animator.globalMatrices[cntIndex++] = vec_05[11];

var vec_06:Vector. = new Vector.;
vec_06[0] = Body_06.transform.rawData[0] * scale; vec_06[1] = Body_06.transform.rawData[1] * scale; vec_06[2] = Body_06.transform.rawData[2] * scale; vec_06[3] = Body_06.x;
vec_06[4] = Body_06.transform.rawData[4] * scale/10; vec_06[5] = Body_06.transform.rawData[5] * scale/10; vec_06[6] = Body_06.transform.rawData[6] * scale/10; vec_06[7] = Body_06.y;
vec_06[8] = Body_06.transform.rawData[8] * scale; vec_06[9] = Body_06.transform.rawData[9] * scale; vec_06[10] = Body_06.transform.rawData[10] * scale; vec_06[11] = Body_06.z;

animator.globalMatrices[cntIndex++] = vec_06[0];
animator.globalMatrices[cntIndex++] = vec_06[4];
animator.globalMatrices[cntIndex++] = vec_06[8];
animator.globalMatrices[cntIndex++] = vec_06[3];
animator.globalMatrices[cntIndex++] = vec_06[1];
animator.globalMatrices[cntIndex++] = vec_06[5];
animator.globalMatrices[cntIndex++] = vec_06[9];
animator.globalMatrices[cntIndex++] = vec_06[7];
animator.globalMatrices[cntIndex++] = vec_06[2];
animator.globalMatrices[cntIndex++] = vec_06[6];
animator.globalMatrices[cntIndex++] = vec_06[10];
animator.globalMatrices[cntIndex++] = vec_06[11];

var vec_07:Vector. = new Vector.;
vec_07[0] = Body_07.transform.rawData[0] * scale; vec_07[1] = Body_07.transform.rawData[1] * scale; vec_07[2] = Body_07.transform.rawData[2] * scale; vec_07[3] = Body_07.x;
vec_07[4] = Body_07.transform.rawData[4] * scale/12; vec_07[5] = Body_07.transform.rawData[5] * scale/12; vec_07[6] = Body_07.transform.rawData[6] * scale/12; vec_07[7] = Body_07.y;
vec_07[8] = Body_07.transform.rawData[8] * scale; vec_07[9] = Body_07.transform.rawData[9] * scale; vec_07[10] = Body_07.transform.rawData[10] * scale; vec_07[11] = Body_07.z;

animator.globalMatrices[cntIndex++] = vec_07[0];
animator.globalMatrices[cntIndex++] = vec_07[4];
animator.globalMatrices[cntIndex++] = vec_07[8];
animator.globalMatrices[cntIndex++] = vec_07[3];
animator.globalMatrices[cntIndex++] = vec_07[1];
animator.globalMatrices[cntIndex++] = vec_07[5];
animator.globalMatrices[cntIndex++] = vec_07[9];
animator.globalMatrices[cntIndex++] = vec_07[7];
animator.globalMatrices[cntIndex++] = vec_07[2];
animator.globalMatrices[cntIndex++] = vec_07[6];
animator.globalMatrices[cntIndex++] = vec_07[10];
animator.globalMatrices[cntIndex++] = vec_07[11];

var vec_08:Vector. = new Vector.;
vec_08[0] = Body_08.transform.rawData[0] * scale; vec_08[1] = Body_08.transform.rawData[1] * scale; vec_08[2] = Body_08.transform.rawData[2] * scale; vec_08[3] = Body_08.x;
vec_08[4] = Body_08.transform.rawData[4] * scale/14; vec_08[5] = Body_08.transform.rawData[5] * scale/14; vec_08[6] = Body_08.transform.rawData[6] * scale/14; vec_08[7] = Body_08.y;
vec_08[8] = Body_08.transform.rawData[8] * scale; vec_08[9] = Body_08.transform.rawData[9] * scale; vec_08[10] = Body_08.transform.rawData[10] * scale; vec_08[11] = Body_08.z;

animator.globalMatrices[cntIndex++] = vec_08[0];
animator.globalMatrices[cntIndex++] = vec_08[4];
animator.globalMatrices[cntIndex++] = vec_08[8];
animator.globalMatrices[cntIndex++] = vec_08[3];
animator.globalMatrices[cntIndex++] = vec_08[1];
animator.globalMatrices[cntIndex++] = vec_08[5];
animator.globalMatrices[cntIndex++] = vec_08[9];
animator.globalMatrices[cntIndex++] = vec_08[7];
animator.globalMatrices[cntIndex++] = vec_08[2];
animator.globalMatrices[cntIndex++] = vec_08[6];
animator.globalMatrices[cntIndex++] = vec_08[10];
animator.globalMatrices[cntIndex++] = vec_08[11];

var vec_09:Vector. = new Vector.;
vec_09[0] = Body_09.transform.rawData[0] * scale; vec_09[1] = Body_09.transform.rawData[1] * scale; vec_09[2] = Body_09.transform.rawData[2] * scale; vec_09[3] = Body_09.x;
vec_09[4] = Body_09.transform.rawData[4] * scale/16; vec_09[5] = Body_09.transform.rawData[5] * scale/16; vec_09[6] = Body_09.transform.rawData[6] * scale/16; vec_09[7] = Body_09.y;
vec_09[8] = Body_09.transform.rawData[8] * scale; vec_09[9] = Body_09.transform.rawData[9] * scale; vec_09[10] = Body_09.transform.rawData[10] * scale; vec_09[11] = Body_09.z;

animator.globalMatrices[cntIndex++] = vec_09[0];
animator.globalMatrices[cntIndex++] = vec_09[4];
animator.globalMatrices[cntIndex++] = vec_09[8];
animator.globalMatrices[cntIndex++] = vec_09[3];
animator.globalMatrices[cntIndex++] = vec_09[1];
animator.globalMatrices[cntIndex++] = vec_09[5];
animator.globalMatrices[cntIndex++] = vec_09[9];
animator.globalMatrices[cntIndex++] = vec_09[7];
animator.globalMatrices[cntIndex++] = vec_09[2];
animator.globalMatrices[cntIndex++] = vec_09[6];
animator.globalMatrices[cntIndex++] = vec_09[10];
animator.globalMatrices[cntIndex++] = vec_09[11];

var vec_10:Vector. = new Vector.;
vec_10[0] = Body_10.transform.rawData[0] * scale; vec_10[1] = Body_10.transform.rawData[1] * scale; vec_10[2] = Body_10.transform.rawData[2] * scale; vec_10[3] = Body_10.x;
vec_10[4] = Body_10.transform.rawData[4] * scale/18; vec_10[5] = Body_10.transform.rawData[5] * scale/18; vec_10[6] = Body_10.transform.rawData[6] * scale/18; vec_10[7] = Body_10.y;
vec_10[8] = Body_10.transform.rawData[8] * scale; vec_10[9] = Body_10.transform.rawData[9] * scale; vec_10[10] = Body_10.transform.rawData[10] * scale; vec_10[11] = Body_10.z;

animator.globalMatrices[cntIndex++] = vec_10[0];
animator.globalMatrices[cntIndex++] = vec_10[4];
animator.globalMatrices[cntIndex++] = vec_10[8];
animator.globalMatrices[cntIndex++] = vec_10[3];
animator.globalMatrices[cntIndex++] = vec_10[1];
animator.globalMatrices[cntIndex++] = vec_10[5];
animator.globalMatrices[cntIndex++] = vec_10[9];
animator.globalMatrices[cntIndex++] = vec_10[7];
animator.globalMatrices[cntIndex++] = vec_10[2];
animator.globalMatrices[cntIndex++] = vec_10[6];
animator.globalMatrices[cntIndex++] = vec_10[10];
animator.globalMatrices[cntIndex++] = vec_10[11];

var vec_11:Vector. = new Vector.;
vec_11[0] = Body_11.transform.rawData[0] * scale; vec_11[1] = Body_11.transform.rawData[1] * scale; vec_11[2] = Body_11.transform.rawData[2] * scale; vec_11[3] = Body_11.x;
vec_11[4] = Body_11.transform.rawData[4] * scale/20; vec_11[5] = Body_11.transform.rawData[5] * scale/20; vec_11[6] = Body_11.transform.rawData[6] * scale/20; vec_11[7] = Body_11.y;
vec_11[8] = Body_11.transform.rawData[8] * scale; vec_11[9] = Body_11.transform.rawData[9] * scale; vec_11[10] = Body_11.transform.rawData[10] * scale; vec_11[11] = Body_11.z;

animator.globalMatrices[cntIndex++] = vec_11[0];
animator.globalMatrices[cntIndex++] = vec_11[4];
animator.globalMatrices[cntIndex++] = vec_11[8];
animator.globalMatrices[cntIndex++] = vec_11[3];
animator.globalMatrices[cntIndex++] = vec_11[1];
animator.globalMatrices[cntIndex++] = vec_11[5];
animator.globalMatrices[cntIndex++] = vec_11[9];
animator.globalMatrices[cntIndex++] = vec_11[7];
animator.globalMatrices[cntIndex++] = vec_11[2];
animator.globalMatrices[cntIndex++] = vec_11[6];
animator.globalMatrices[cntIndex++] = vec_11[10];
animator.globalMatrices[cntIndex++] = vec_11[11];

var vec_12:Vector. = new Vector.;
vec_12[0] = Body_12.transform.rawData[0] * scale; vec_12[1] = Body_12.transform.rawData[1] * scale; vec_12[2] = Body_12.transform.rawData[2] * scale; vec_12[3] = Body_12.x;
vec_12[4] = Body_12.transform.rawData[4] * scale/22; vec_12[5] = Body_12.transform.rawData[5] * scale/22; vec_12[6] = Body_12.transform.rawData[6] * scale/22; vec_12[7] = Body_12.y;
vec_12[8] = Body_12.transform.rawData[8] * scale; vec_12[9] = Body_12.transform.rawData[9] * scale; vec_12[10] = Body_12.transform.rawData[10] * scale; vec_12[11] = Body_12.z;

animator.globalMatrices[cntIndex++] = vec_12[0];
animator.globalMatrices[cntIndex++] = vec_12[4];
animator.globalMatrices[cntIndex++] = vec_12[8];
animator.globalMatrices[cntIndex++] = vec_12[3];
animator.globalMatrices[cntIndex++] = vec_12[1];
animator.globalMatrices[cntIndex++] = vec_12[5];
animator.globalMatrices[cntIndex++] = vec_12[9];
animator.globalMatrices[cntIndex++] = vec_12[7];
animator.globalMatrices[cntIndex++] = vec_12[2];
animator.globalMatrices[cntIndex++] = vec_12[6];
animator.globalMatrices[cntIndex++] = vec_12[10];
animator.globalMatrices[cntIndex++] = vec_12[11];

var vec_13:Vector. = new Vector.;
vec_13[0] = Body_13.transform.rawData[0] * scale; vec_13[1] = Body_13.transform.rawData[1] * scale; vec_13[2] = Body_13.transform.rawData[2] * scale; vec_13[3] = Body_13.x;
vec_13[4] = Body_13.transform.rawData[4] * scale/24; vec_13[5] = Body_13.transform.rawData[5] * scale/24; vec_13[6] = Body_13.transform.rawData[6] * scale/24; vec_13[7] = Body_13.y;
vec_13[8] = Body_13.transform.rawData[8] * scale; vec_13[9] = Body_13.transform.rawData[9] * scale; vec_13[10] = Body_13.transform.rawData[10] * scale; vec_13[11] = Body_13.z;

animator.globalMatrices[cntIndex++] = vec_13[0];
animator.globalMatrices[cntIndex++] = vec_13[4];
animator.globalMatrices[cntIndex++] = vec_13[8];
animator.globalMatrices[cntIndex++] = vec_13[3];
animator.globalMatrices[cntIndex++] = vec_13[1];
animator.globalMatrices[cntIndex++] = vec_13[5];
animator.globalMatrices[cntIndex++] = vec_13[9];
animator.globalMatrices[cntIndex++] = vec_13[7];
animator.globalMatrices[cntIndex++] = vec_13[2];
animator.globalMatrices[cntIndex++] = vec_13[6];
animator.globalMatrices[cntIndex++] = vec_13[10];
animator.globalMatrices[cntIndex++] = vec_13[11];

var vec_14:Vector. = new Vector.;
vec_14[0] = Body_14.transform.rawData[0] * scale; vec_14[1] = Body_14.transform.rawData[1] * scale; vec_14[2] = Body_14.transform.rawData[2] * scale; vec_14[3] = Body_14.x;
vec_14[4] = Body_14.transform.rawData[4] * scale/26; vec_14[5] = Body_14.transform.rawData[5] * scale/26; vec_14[6] = Body_14.transform.rawData[6] * scale/26; vec_14[7] = Body_14.y;
vec_14[8] = Body_14.transform.rawData[8] * scale; vec_14[9] = Body_14.transform.rawData[9] * scale; vec_14[10] = Body_14.transform.rawData[10] * scale; vec_14[11] = Body_14.z;

animator.globalMatrices[cntIndex++] = vec_14[0];
animator.globalMatrices[cntIndex++] = vec_14[4];
animator.globalMatrices[cntIndex++] = vec_14[8];
animator.globalMatrices[cntIndex++] = vec_14[3];
animator.globalMatrices[cntIndex++] = vec_14[1];
animator.globalMatrices[cntIndex++] = vec_14[5];
animator.globalMatrices[cntIndex++] = vec_14[9];
animator.globalMatrices[cntIndex++] = vec_14[7];
animator.globalMatrices[cntIndex++] = vec_14[2];
animator.globalMatrices[cntIndex++] = vec_14[6];
animator.globalMatrices[cntIndex++] = vec_14[10];
animator.globalMatrices[cntIndex++] = vec_14[11];

var vec_15:Vector. = new Vector.;
vec_15[0] = Body_15.transform.rawData[0] * scale; vec_15[1] = Body_15.transform.rawData[1] * scale; vec_15[2] = Body_15.transform.rawData[2] * scale; vec_15[3] = Body_15.x;
vec_15[4] = Body_15.transform.rawData[4] * scale/28; vec_15[5] = Body_15.transform.rawData[5] * scale/28; vec_15[6] = Body_15.transform.rawData[6] * scale/28; vec_15[7] = Body_15.y;
vec_15[8] = Body_15.transform.rawData[8] * scale; vec_15[9] = Body_15.transform.rawData[9] * scale; vec_15[10] = Body_15.transform.rawData[10] * scale; vec_15[11] = Body_15.z;

animator.globalMatrices[cntIndex++] = vec_15[0];
animator.globalMatrices[cntIndex++] = vec_15[4];
animator.globalMatrices[cntIndex++] = vec_15[8];
animator.globalMatrices[cntIndex++] = vec_15[3];
animator.globalMatrices[cntIndex++] = vec_15[1];
animator.globalMatrices[cntIndex++] = vec_15[5];
animator.globalMatrices[cntIndex++] = vec_15[9];
animator.globalMatrices[cntIndex++] = vec_15[7];
animator.globalMatrices[cntIndex++] = vec_15[2];
animator.globalMatrices[cntIndex++] = vec_15[6];
animator.globalMatrices[cntIndex++] = vec_15[10];
animator.globalMatrices[cntIndex++] = vec_15[11];

cntIndex = 0;
}

_view.render();
SignatureBitmap.y = stage.stageHeight - Signature.height;
}

private var char:ObjectContainer3D;

//animation variables
private var mesh:Mesh;
private var animator:SkeletonAnimator;
private var animationSet:SkeletonAnimationSet;
private var skeleton:Skeleton;
private function loaded(evt:AssetEvent):void
{
if (evt.asset.assetType == AssetType.CONTAINER) {
char = ObjectContainer3D(evt.asset);
}
if (evt.asset.assetType == AssetType.MATERIAL) {
var material:TextureMaterial = TextureMaterial(evt.asset);
material.lightPicker = lightPicker;
material.ambient = 0.5;
material.ambientColor = 0xffffff;
material.gloss = 1;
material.specular = 0.5;
material.specularColor = 0xffffff;
}

if (evt.asset.assetType == AssetType.SKELETON) {
trace("SKELETON");
skeleton = evt.asset as Skeleton;
}
else if (evt.asset.assetType == AssetType.ANIMATION_STATE) {
trace("ANIMATION_STATE");
var state:SkeletonAnimationState = evt.asset as SkeletonAnimationState;
}
else if (evt.asset.assetType == AssetType.ANIMATION_SET) {
trace("ANIMATION_SET");
animationSet = evt.asset as SkeletonAnimationSet;
animator = new SkeletonAnimator(animationSet, skeleton, true);

//apply our animator to our mesh
mesh.animator = animator;
animator.play("default");
} else if (evt.asset.assetType == AssetType.MESH) {
trace("MESH");

//create mesh object
mesh = evt.asset as Mesh;
}
}

private function complete(evt:LoaderEvent):void
{
AssetLibrary.removeEventListener(AssetEvent.ASSET_COMPLETE, loaded);
evt.target.removeEventListener(LoaderEvent.RESOURCE_COMPLETE, complete);
_view.scene.addChild(char);
}

}
}

尚、誠に申し訳ございませんが
上記のプログラムですがアメーバの字数制限のためimport文をすべて消しています。