so you suggest to start the animation in onKeyDown?
i tryied it, but i couldnt stop it in onKeyUp when use
model.AnimationLibrary.getAnimation("run").animator.stop().It stops
but it cannot play more animations.

On May 11, 4:33 pm, Michael Iv <[email protected]> wrote:
> I think the problem may be that you play the animation anew each frame while
> the specific key is down . Look at your code , when for example the back key
> is down you tell the animator to start play on each frame , you repeat the
> command over and over .
>
>
>
> On Tue, May 11, 2010 at 4:26 PM, toshmosh <[email protected]> wrote:
> > I am using the ogre model in the examples.
>
> > On May 11, 3:14 pm, Michael Iv <[email protected]> wrote:
> > > can you tell me what program do you use for naming animation sequences
> > for
> > > MD2 ?
>
> > > On Tue, May 11, 2010 at 9:52 AM, toshmosh <[email protected]>
> > wrote:
> > > > Hi!Whit my friend have started to develop 3d game with away3d for
> > > > school topic and we cannot deal with the animations.I am loading two
> > > > md2 models- the ogre from the lessons, then in onKeyDown it is
> > > > registered where to move in boolean variables , in onKeyUp is
> > > > deregistered, and in onEnterFrame this variables  are checked in if
> > > > forward is true it plays the run animation else play the stand.The
> > > > game plays the run animation once and then cannot change to stand.Any
> > > > suggestions? onkeyDown and onKeyUp are down, just scroll.Also there
> > > > are two extern files for Terrain and Resources,but they are not
> > > > related:
>
> > > > package
> > > > {
> > > >        import away3d.animators.data.*;
> > > >        import away3d.cameras.*;
> > > >        import away3d.containers.*;
> > > >        import away3d.core.base.*;
> > > >        import away3d.core.clip.*;
> > > >        import away3d.core.filter.*;
> > > >        import away3d.core.math.*;
> > > >        import away3d.core.render.*;
> > > >        import away3d.core.utils.*;
> > > >        import away3d.events.*;
> > > >        import away3d.lights.*;
> > > >        import away3d.loaders.*;
> > > >        import away3d.materials.*;
> > > >        import away3d.materials.utils.*;
> > > >        import away3d.primitives.*;
>
> > > >        import flash.display.*;
> > > >        import flash.events.*;
> > > >        import flash.filters.*;
> > > >        import flash.ui.Keyboard;
>
> > > >        import wumedia.vector.VectorText;
> > > >        [SWF(backgroundColor="#000000", frameRate="30", quality="LOW",
> > > > width="800", height="600")]
>
> > > >        public class Game extends Sprite
> > > >        {
>
> > > >                [Embed (source="../fonts/extrusionfonts.swf",
> > > > mimeType="application/
> > > > octet-stream")]
> > > >                public static const Fonts:Class;
> > > >                private var textfield:TextField3D;
>
> > > >                //engine variables
> > > >        public var scene:Scene3D;
> > > >                public var camera:SpringCam;
> > > >                public var view:View3D;
> > > >                public var skybox:Skybox6;
> > > >                public var frustum_clipping:FrustumClipping;
> > > >                public var nearfield_clipping:NearfieldClipping;
>
> > > >                //scene objects
> > > >                private var md2:Md2;
> > > >                private var md22:Md2;
> > > >                private var model:Mesh;
> > > >                private var model2:Mesh;
> > > >                private var isModelMoving:Boolean;
>
> > > >                //movement
> > > >                private var moving:Boolean = false;
> > > >                private var forward:Boolean = false;
> > > >                private var backward:Boolean = false;
> > > >                private var turnLeft:Boolean = false;
> > > >                private var turnRight:Boolean = false;
> > > >                private var stillMoving:Boolean = false;
> > > >                private var jump:Boolean = false;
> > > >                private var count:int = 0;
>
> > > >                public var res:Resources;
> > > >                public var terrain:Terrain;
>
> > > >                //lights
> > > >                public var simpleShadow:SimpleShadow;
>
> > > >                public var sunLight:DirectionalLight3D;
>
> > > >                public function Game()
> > > >                {
> > > >                        addEventListener(Event.ADDED_TO_STAGE, init);
> > > >                }
>
> > > >                private function init(evt:Event):void
> > > >                {
> > > >                        res = new Resources();
> > > >                        initEngine();
> > > >                        terrain = new Terrain();
> > > >                        initObjects();
> > > >                        initListeners();
>
> > > >                }
>
> > > >                private function initEngine():void
> > > >                {
> > > >                        scene = new Scene3D();
>
> > > >                        frustum_clipping = new FrustumClipping();
> > > >                        frustum_clipping.minZ = -50;
> > > >                        frustum_clipping.maxZ = 400;
>
> > > >                        nearfield_clipping = new NearfieldClipping();
> > > >                        view = new View3D();
> > > >                        view.scene = scene;
> > > >                        view.clipping = frustum_clipping;
> > > >                        //view.camera = camera;
>
> > > >                        /*var fogColour:ColorMaterial = new
> > > > ColorMaterial(0x002222);
> > > >                        var renderer:BasicRenderer = (view.renderer as
> > > > BasicRenderer);
> > > >                        var mfilters:Array = [new
> > > > FogFilter({minZ:100,maxZ:500,subdivisions:
> > > > 20,material:fogColour})];
> > > >                        renderer.filters = mfilters;*/
>
> > > >                        addChild(view);
>
> > > >                        //sunLight = new DirectionalLight3D();
> > > >                        //sunLight.direction = new Number3D(0, -1, 0);
> > > >                        //sunLight.ambient = 20;
> > > >                        //sunLight.diffuse = 40;
> > > >                        //sunLight.specular = 300;
> > > >                        //sunLight.brightness = 100;
> > > >                        //sunLight = new PointLight3D( { x:0, y:-1, z:
> > 0,
> > > > brightness:1000,
> > > > ambient:0.1, diffuse:0.7 } );
> > > >            //scene.addLight(sunLight);
>
> > > >                        VectorText.extractFont(new Fonts(),null,false);
>
> > > >                }
>
> > > >                private function initObjects():void
> > > >                {
> > > >                        //model = Md2.parse(OgreMesh,
> > {material:material})
> > > > as Mesh;
>
> > > >                        //glowFilter = new GlowFilter();
> > > >                        //blurFilter = new BlurFilter();
> > > >                        //model.addOnMouseOver(modelOnMouseOver);
>
> > > >                        /*var blur:BlurFilter = new BlurFilter();
> > > >                        blur.blurX = 100;
> > > >                        blur.blurY = 100;
> > > >                        blur.quality = BitmapFilterQuality.MEDIUM;
> > > >                        model.ownCanvas = true;
> > > >                        model.filters = [blur]; */
>
> > > >                        skybox = new Skybox6(res.sky_material);
> > > >                        skybox.quarterFaces();
> > > >                        scene.addChild(skybox);
>
> > > >                        scene.addChild(terrain.extrude);
> > > >                        terrain.ReadTerrain();
>
> > > >                        md2 = new Md2();
> > > >                        model =(md2.parseGeometry(res.OgreMesh) as
> > Mesh);
> > > >                        model.material = res.ogre_material;
> > > >                        model.scale(0.01);
> > > >                        model.moveUp(30);
> > > >                        model.position = new Number3D(0,0,0);
> > > >                        scene.addChild(model);
>
> > > >                        md22 = new Md2();
> > > >                        model2 =(md22.parseGeometry(res.BobaMesh) as
> > Mesh);
> > > >                        model2.material = res.boba_material;
> > > >                        model2.scale(0.01);
> > > >                        model2.moveUp(30);
> > > >                        model2.position = new Number3D(0,0,0);
> > > >                        scene.addChild(model2);
>
> > > >  //model2.animationLibrary.getAnimation("deatha").animator.loop =
> > > > false;
>
> > > >  //model2.animationLibrary.getAnimation("deathb").animator.loop =
> > > > false;
>
> > > >  //model2.animationLibrary.getAnimation("deathc").animator.loop =
> > > > false;
>
> > > >  //model2.animationLibrary.getAnimation("stand").animator.play();
>
> > > >                                                var filters:Array = new
> > > > Array();
>
> > > >  //color,alpha,blurx,blury,strength,quality,inner-whether the glow
> > > > is inner,knockout
> > > >                        filters.push(new GlowFilter(0x000000, 1, 19, 19,
> > 5,
> > > > 1, false,
> > > > false));
> > > >                        model.ownCanvas = true;
> > > >                        model.filters = filters;
>
> > > >                        camera = new SpringCam();
> > > >                        camera.target = model2;
> > > >                        camera.positionOffset = new Number3D(120,50,0);
> > > >                        camera.damping = 50;
> > > >                        camera.stiffness = 20;
> > > >                        camera.rotationY = 90;
> > > >                        //camera.target = model;
> > > >                        //camera.lookAt(model.position);
> > > >                        //camera.position = model.position;
> > > >                        view.camera = camera;
> > > >                        //camera.lookAt(textfield.position);
>
> > > >                        textfield = new TextField3D("Arial");
> > > >                        textfield.text = "Ogre";
> > > >                        textfield.material = res.material2;
> > > >                        textfield.size = 31;
> > > >                        textfield.leading = 50;
>
> ...
>
> read more »

Reply via email to