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; > > textfield.letterSpacing = 2; > > textfield.width = 200; > > textfield.align = "C"; > > textfield.position = model.position; > > textfield.rotationY +=270; > > textfield.moveUp(120); > > //textfield.moveForward(30); > > textfield.bothsides = true; > > scene.addChild(textfield); > > } > > > private function initListeners():void > > { > > addEventListener(Event.ENTER_FRAME, onEnterFrame); > > stage.addEventListener(MouseEvent.MOUSE_DOWN, > > onMouseDown); > > stage.addEventListener(MouseEvent.MOUSE_UP, > > onMouseUp); > > stage.addEventListener(MouseEvent.MOUSE_MOVE, > > onMouseMove); > > stage.addEventListener(Event.RESIZE, onResize); > > stage.addEventListener(KeyboardEvent.KEY_DOWN, > > onKeyDown); > > stage.addEventListener(KeyboardEvent.KEY_UP, > > onKeyUp); > > > stage.addEventListener(MouseEvent.MOUSE_WHEEL,onMouseWheel); > > onResize(); > > } > > ... > > read more »
