Hello all,
I want to make a simple room... User can walk through the
room.. With in the room i place small 3ds components ... so i use
skybox... I dont know how to increase the width and height... is any
other idea to make a room...
Previously i use SegmentsExtrude ... create floor and ceil using
plane.. create other three faces using SegmentsExtrude .. But i dont
know how to walk through the room using camera... Here i mentioned
the Listeners.. using the listeners camera walk around the component..
does not go inside.. how to do this...
thanks
arul
-------------------
CODE
-------------------
public function initObjects():void {
var xPoints:Array = new Array();
xPoints.push(new Number3D(0, 0, 0));
xPoints.push(new Number3D(0, 0, wallwidth));
var yPoints:Array = new Array();
yPoints.push(new Number3D(0, 0, 0));
yPoints.push(new Number3D(wallwidth, 0, 0));
var zPoints:Array = new Array();
zPoints.push(new Number3D(wallwidth, 0, 0));
zPoints.push(new Number3D(wallwidth, 0, wallwidth));
scene.addChild(createSegment(xPoints));
scene.addChild(createSegment(yPoints));
scene.addChild(createSegment(zPoints));
scene.addChild(createFloor());
scene.addChild(createCeil());
}
public function createSegment(aPoints:Array):SegmentsExtrude {
//generate the wall
var wallThickness:Number = 20;
//aPoints.push(new Number3D(0, 0, 0));
var segment:SegmentsExtrude = new
SegmentsExtrude(aPoints,
{coverall: false, axis: "y", offset: wallHeight, recenter: true,
closepath: false, subdivision: 10, thickness_subdivision: 1, flip:
false, thickness: wallThickness, bothsides: true, segmentsH: 24,
segmentsW: 12, material: front});
segment.bothsides = true;
return segment;
}
public function createFloor():Plane {
var plane:Plane = new Plane({width: wallwidth, height:
wallwidth,
segmentsH: 24, segmentsW: 12, material: down});
plane.moveRight(wallwidth/2);
plane.moveForward(wallwidth/2);
plane.bothsides = true;
return plane;
}
public function onEnterFrame(e:Event):void {
if (over){
camera.targetpanangle = 0.3 * (stage.mouseX -
lastMouseX) +
lastPanAngle;
camera.targettiltangle = 0.3 * (stage.mouseY -
lastMouseY) +
lastTiltAngle;
}
camera.hover();
viewer.render();
}
private function onMouseOver(e:MouseEvent):void {
over = true;
lastMouseX = stage.mouseX;
lastMouseY = stage.mouseY;
lastPanAngle = camera.panangle;
lastTiltAngle = camera.tiltangle;
}
private function onMouseLeave(e:Event):void {
over = false;
}
public function createCeil():Plane {
var plane:Plane = new Plane({width: wallwidth, height:
wallwidth,
segmentsH: 24, segmentsW: 12, material: up});
plane.moveRight(wallwidth/2);
plane.moveForward(wallwidth/2);
plane.moveUp(wallHeight);
plane.bothsides = true;
return plane;
}