Resulta que quiero mover los vértices de un plano mediante un enterframe y no sé porqué, pero solo me lo ejecuta una vez, en vez de todo el rato.
Si igualo por ejemplo a un numero exacto en vez de un incremento, sí que lo hace y el vertice va a ese punto, pero yo necesito un incremento en tiempo. No sé que está ocurriendo la verdad...
Adjunto captura y código.
Código ActionScript :
package { import away3d.*; import away3d.animators.*; import away3d.animators.data.Skeleton; import away3d.containers.*; import away3d.controllers.HoverController; import away3d.core.managers.*; import away3d.core.math.Plane3D; import away3d.core.pick.*; import away3d.core.render.*; import away3d.debug.*; import away3d.entities.*; import away3d.events.*; import away3d.library.*; import away3d.lights.*; import away3d.loaders.Loader3D; import away3d.loaders.parsers.*; import away3d.materials.*; import away3d.materials.lightpickers.*; import away3d.materials.methods.*; import away3d.primitives.*; import away3d.textures.*; import away3d.tools.commands.Weld; import away3d.utils.*; import flash.display.*; import flash.display.Stage3D; import flash.display3D.Context3D; import flash.display3D.Context3DProgramType; import flash.display3D.Context3DVertexBufferFormat; import flash.display3D.Program3D; import flash.events.Event; import flash.geom.Matrix3D; import flash.geom.Vector3D; import flash.net.URLRequest; import net.hires.debug.Stats; import starling.core.Starling; [SWF(frameRate="60", width="800",height="600", backgroundColor="0x333333")] public class LibroProyect extends Sprite { [Embed(source="1.png")] private var img1:Class; [Embed(source="2.png")] private var img2:Class; [Embed(source="3.png")] private var img3:Class; [Embed(source="4.png")] private var img4:Class; [Embed(source="5.png")] private var img5:Class; [Embed(source="6.png")] private var img6:Class; private var stats:Stats; private var view:View3D; private var plane:Mesh; private var cube:Mesh; private var hc:HoverController; private var stage3DManager:Stage3DManager; private var stage3DProxy:Stage3DProxy; private var mierda:uint = 1; public function LibroProyect() { stats = new Stats(); this.addChild(stats); init(); } private function init():void { trace("llega"); stage3DManager = Stage3DManager.getInstance(stage); stage3DProxy = stage3DManager.getFreeStage3DProxy(); stage3DProxy.addEventListener(Stage3DEvent.CONTEXT3D_CREATED, onContextCreated); } private function onContextCreated(event:Event):void { initAway3d(); initStarling(); addEventListener(Event.ENTER_FRAME, loop); } private function initStarling():void{ } private function initAway3d():void{ view = new View3D(); view.stage3DProxy = stage3DProxy; view.shareContext = true; addChild(view); //plane = new Mesh(new PlaneGeometry(700, 700), new TextureMaterial(Cast.bitmapTexture(img1))); plane = new Mesh(new PlaneGeometry(700, 700, 1, 1,true),new ColorMaterial(0xFF0000)); plane.material.bothSides = true; /*var btc:BitmapCubeTexture = new BitmapCubeTexture(new img1().bitmapData, new img2().bitmapData, new img3().bitmapData, new img4().bitmapData, new img5().bitmapData, new img6().bitmapData); cube = new Mesh(new CubeGeometry(200, 200, 200, 1, 1, 1, true), new SkyBoxMaterial(btc));*/ //var geometry:PlaneGeometry = new PlaneGeometry(700, 350, 15, 15,true); //plane = new Mesh(geometry, new ColorMaterial(0xFF0000)); //view.scene.addChild(cube); view.scene.addChild(plane); view.camera.z = -500; view.camera.y = 300; view.camera.position = new Vector3D(700, 300, 800); view.camera.lookAt( new Vector3D(0, 0, 0) ); var activa:Boolean = true; //hc=new HoverController(view.camera, null, 1000, 1100, 2000); } protected function loop(event:Event):void { plane.geometry.subGeometries[0].vertexData[1] +=1; trace(plane.geometry.subGeometries[0].vertexData[1]); //plane.geometry.subGeometries[0].vertexData[1] = 500; stage3DProxy.clear(); //hc.panAngle = mouseX - 320; //hc.tiltAngle = mouseY - 240; //plane.rotationY +=1; //plane.rotationZ +=1; //cube.rotationY -=1 view.render(); stage3DProxy.present(); } } }