Showing posts with label Away3D MovieMesh. Show all posts
Showing posts with label Away3D MovieMesh. Show all posts

Wednesday, June 30, 2010

Tracking Vertices In Away3D Animated 3D Models

Tracking Vertex Positions In Away3D MovieMesh Class For Animated Models In Away3dLite (Jan. 28th 2010 )

**Useful for interchangeable handheld weapons for models to find attachment points**

Add MovieMesh Variable Declaration:
public var leftHandx:Number;

public var leftHandy:Number;

public var leftHandz:Number;


MovieMesh.onEnterFrame:

Place after "while(i--)" update of all vertices:

var tempOffset:int = 100;

leftHandx = _vertices[(tempOffset*3)];

leftHandy = _vertices[(tempOffset*3) + 1];

leftHandz = _vertices[(tempOffset*3) + 2];


Added to MyProject code:

mySphere = new Sphere();
mySphere.radius = 10;
mySphere.x = mySphere.y = mySphere.z = 0;
scene.addChild(mySphere);


MyProject.onEnterFrame:

//trace(mesh.leftHandx);
mySphere.x = mesh.leftHandx;
mySphere.y = mesh.leftHandy;
mySphere.z = mesh.leftHandz;