So its no good idea to work with AS3Exporter for my purpose? Again my
current point of view:
i have to animate a character at runtime with several movement-
sequences. At this time every sequence is saved as a single md2
including the whole model and animation. So every md2 is playable
alone.
i export and save every md2 as as3 via
var s : String = md2.asAS3Class('Walk','animationSequences', true,
true); System.setClipboard(s); -> save new Class()
(animationSequences.Walk.as)
then:
private var animationSequence:Mesh;
..
animationSequence = new Walk();
animationSequence.play(new AnimationSequence("frame", true, true,
10));
..
onEnterFrame -> view.scene.updateTime();
this works quite fine and the animation seems to work properly. Whats
the problem with it you mentioned?
But from now on i didnt get the right point to jump in. How to trigger
the different sequences? I tried it in two different ways. But neither
that:
switch(animationSequence) {
case AnimationFactory.animation_jump:
animationSequence =
AnimationFactory.animation_walk;
animationSequence.transitionValue = 5;
animationSequence.play(new
AnimationSequence("walk", true, true,
10));
break;
case AnimationFactory.animation_walk:
animationSequence =
AnimationFactory.animation_jump;
animationSequence.transitionValue = 5;
animationSequence.play(new
AnimationSequence("anim", true, true,
10));
break;
}
nor that works:
var ani1 : Mesh = AnimationFactory.animation_jump;
var ani2 : Mesh = AnimationFactory.animation_walk;
animation = new Animator(but1, [{vertices:ani1.vertices,
prefix:"anim"},{vertices:ani2.vertices, prefix:"walk"}],
{material:material, y:0, x:0, z:0, bothsides:true},
true);
animation.play(new AnimationSequence("anim", true, true, 10));
There is no tutorial somewhere which explains something in that way?
olee
On 18 Jun., 13:37, Fabrice3D <[email protected]> wrote:
> > - is it the proper way to export every animation-sequence as a single
> > md2 which also contains the whole geometry-information? Or will
> > vertice-duplicates in the geometry be ignored from the engine?
>
> yes, its the propper way, the md2 or as3 contains the master: the
> mesh, uvs etc.., and the frames: the vertexes positions per frames.
>
> > - is there some manager to handle the different sequences. i fooled
> > around with the animator (http://www.closier.nl/blog/?cat=6), tried to
> > register the sequences.
> > But if i get the point the animator is there to manage still md2 to
> > simulate a animated md2, right?
>
> no animator, is like md2, you pass a mesh and a series of vertexes per
> frames.
> result is same as md2, except it can be generated runtime and can
> support any dynamical shape.
>
> > - Since my whole framework environment runs with 30 fps - the md2-ani
> > should run also with 30 fps, or ist it possible to export them with a
> > lower framerate? ( aka lower filesize?)
>
> the frames are interpolated, so where your movement say "sit" doesn't
> require much frames,
> you do not need to export many frames in your md2. a "run" would
> require more.
> the interpolation is linear, so where motion holds some joints, the
> numbers of frames required is higher.
> it also a question of feel and design... say per case different.
> note that you can have per md2/as3 sequences different play rates.
>
> > - the model has a total polycount of around 1000. Each md2 has a size
> > of 96kB > exported to AS3 -> 400kB. Do i some mistake?
>
> no, md2 is binary format, the as3 will be compressed by the internal
> lz77 once compiled.
> but its not as efficient as the AS3Exporter. But unfortunaltly the
> as3exporter is not yet supporting the animation properly.
> its high on my todo list.
>
> Fabrice
>
> On Jun 18, 2009, at 1:42 AM, renkster wrote:
>
>
>
> > Just another question. i decide to throw all my questions inside this
> > thread, so maybe this might be helpful for somebody other starting
> > with away3d and md2.
>
> > So - ive got a character which should perform several animations
> > triggered at runtime.
>
> > Some questions:
>
> > - is it the proper way to export every animation-sequence as a single
> > md2 which also contains the whole geometry-information? Or will
> > vertice-duplicates in the geometry be ignored from the engine?
>
> > - is there some manager to handle the different sequences. i fooled
> > around with the animator (http://www.closier.nl/blog/?cat=6), tried to
> > register the sequences.
> > But if i get the point the animator is there to manage still md2 to
> > simulate a animated md2, right?
>
> > - Since my whole framework environment runs with 30 fps - the md2-ani
> > should run also with 30 fps, or ist it possible to export them with a
> > lower framerate? ( aka lower filesize?)
>
> > - the model has a total polycount of around 1000. Each md2 has a size
> > of 96kB > exported to AS3 -> 400kB. Do i some mistake?
>
> > thanks again before :-),
> > olee
>
> > On 17 Jun., 16:24, renkster <[email protected]> wrote:
> >> okay, i found the problem.
>
> >> md2.play(new AnimationSequence("run", true, true, 10));
> >> i didnt recognized the sequence in the md2 has to be named and
> >> called
> >> by this name via AnimationSequence.
>
> >> But no worries - I dont think this will be my last question ;-)
>
> >> Thanks
>
> >> On 17 Jun., 15:15, renkster <[email protected]> wrote:
>
> >>> Hey Fabrice,
>
> >>> thanks for your answer. Would you be so kind to spend me again a bit
> >>> of your time?
>
> >>> My model is loaded correct, also the texture(with some uv-problems,
> >>> but this may be done later)
> >>> But no animation is played.
>
> >>> A short schematic- rundown of what iam trying: Something wrong
> >>> implemented?
>
> >>> Olee
>
> >>> package firstContact
> >>> {
> >>> public class FirstConatctAway3D extends Sprite
> >>> {
> >>> public var view : View3D;
> >>> public var sphere : Sphere;
>
> >>> [Embed(source="../../assets/firstContact/
> >>> test_6.md2",mimeType="application/octet-stream")]
> >>> public static const BMD2 : Class;
>
> >>> [Embed(source="../../assets/firstContact/
> >>> texture_low.jpg")]
> >>> public static var Texture : Class;
>
> >>> public function FirstConatctAway3D()
> >>> {
> >>> initObjects();
> >>> addEventListener(Event.ENTER_FRAME,
> >>> onEnterFrame);
> >>> }
>
> >>> private function initObjects() : void
> >>> {
>
> >>> md2 = Md2.parse(BMD2, {ownCanvas:true,
> >>> name:"torso",
> >>> material:material, back:material});
> >>> md2.movePivot((md2.minX + md2.maxX) / 2,
> >>> (md2.minY + md2.maxY) / 2,
> >>> (md2.minZ + md2.maxZ) / 2);
> >>> md2.x = md2.z = 0;
> >>> md2.scale(1);
> >>> md2.y = 2000;
> >>> md2.play(new AnimationSequence("run",
> >>> true, true, 10));
> >>> view.scene.addChild(md2);
> >>> }
>
> >>> private function onEnterFrame(event : Event) : void
> >>> {
> >>> md2.rotationY += 1;
> >>> view.scene.updateTime();
> >>> view.render();
> >>> }
> >>> }
>
> >>> }
>
> >>> On 17 Jun., 13:09, Fabrice3D <[email protected]> wrote:
>
> >>>> Hi Olee,
> >>>> Welcome to Away!
>
> >>>> for your md2, if you do not will make the same md2 url dynamic
> >>>> you indeed can export to as3.
> >>>> Use the Mesh method (the animation export is not yet implemnted
> >>>> in the
> >>>> as3Exporter class)
> >>>> like this
>
> >>>> myloadedmd2.asAS3Class("Coolname", "coolpackagename", true, true);
>
> >>>> save the clipboard in textapp as Coolname.as
> >>>> then add to your code, import coolpackagename.Coolname;
>
> >>>> var myanim:Coolname = new Coolname();
> >>>> view.scene.addChild(myAnim);
>
> >>>> from now on, "driving the animation is the same for AS3 or md2,
> >>>> same
> >>>> rule for Animator native class.
> >>>> myAnim.play(new AnimationSequence("run", true, true, 10));
>
> >>>> in your enterframe, add the line
>
> >>>> view.scene.updateTime();
>
> >>>> you have a whole collection of methods, event that can be used,
> >>>> set...
> >>>> this should help you get started. --> read the online doc
>
> >>>> Fabrice
>
> >>>> On Jun 17, 2009, at 12:59 PM, [email protected] wrote:
>
> >>>>> Hi Group,
>
> >>>>> first of all - this is my first project using the away3d library
> >>>>> and
> >>>>> iam pretty anticipated to work with it. but unfortunately the
> >>>>> timescale for the project is quite tight so maybe i have to ask
> >>>>> some
> >>>>> silly questions instead of enjoing the learning process :-)
>
> >>>>> First thing: i have to animate a character, which is exported
> >>>>> from max
> >>>>> as md2 with different animated sequences. the sequences has to be
> >>>>> imported, played and blended over.
>
> >>>>> So far i think the best way is to convert the md2 as as3 - but
> >>>>> from
> >>>>> this point iam confused how do i have to use the animation-
> >>>>> engine from
> >>>>> away.
> >>>>> Is it just a : instance_of_seq_01.play(),
> >>>>> or do i have to use the AnimationSequence ? (instance.play(new
> >>>>> AnimationSequence("run", true, true, 30)))
>
> >>>>> Is there somewhere a quick rundown which is the best way to do
> >>>>> this i
> >>>>> havent seen yet?
> >>>>> Or is somebody willing to push me in the right direction?
>
> >>>>> Thanks in advance,
> >>>>> Olee