Hi guys, ok so far I have two classes in my project. A document class which sets up the Papervision3D environment (camera, scene etc) and then it creates instance of a class called “Bar”. Bar.as creates cubes using PV3D’s “materialsList”, “new Cube()” etc etc…
Now, in the document class, once I’ve finished instanciating all my bars, I try to start an onEnterFrame which rotates the bars in the scene but that’s where I’m having trouble. Here’s the document class…
package
{
import flash.display.MovieClip;
import flash.events.Event;
import org.papervision3d.cameras.Camera3D;
import org.papervision3d.scenes.MovieScene3D;
import com.Bar;
public class BarsSetup extends MovieClip
{
public var container: MovieClip;
public var scene: MovieScene3D;
public var camera: Camera3D;
public var bar1:Bar;
public function BarsSetup() {
setupPapervision();
var bar1:Bar = new Bar(scene, 100);
scene.renderCamera( camera );
stage.addEventListener(Event.ENTER_FRAME, enterFrame);
}
public function setupPapervision() {
container = new MovieClip();
container.x = 300;
container.y = 200;
addChild( container );
scene = new MovieScene3D( container );
camera = new Camera3D();
camera.z = -500;
camera.zoom = 5;
}
public function enterFrame(event:Event) {
// *** ROTATE BAR1 HERE ***
scene.renderCamera( camera );
}
}
}
And here’s the “Bars.as” class…
package {
import flash.display.Sprite;
import org.papervision3d.objects.Cube;
import org.papervision3d.materials.WireframeMaterial;
import org.papervision3d.materials.MaterialsList;
public class Bar extends Sprite {
public var bar:Cube;
public var thisBar:Sprite;
public function Bar(sceneBase, xPos:Number) {
var allM:WireframeMaterial = new WireframeMaterial();
allM.lineColor = 0x000000;
var materialsList:MaterialsList = new MaterialsList();
materialsList.addMaterial(allM, "all");
var bar = new Cube(materialsList, 200, 200, 200);
bar.x = xPos;
sceneBase.addChild(bar);
}
}
}
Everything loads up ok with no errors in this case but what exactly do I write on the line which I’ve marked “// *** ROTATE BAR1 HERE ***”?
Really hope you guys can help! Thanks very much,
Dave