Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function createPool():void {
- var planeSize:Number = 50;
- var poolThickness:Number = 5;
- var thickOffSet:Number = poolThickness / 2;
- var sizeOffset:Number = planeSize / 2;
- var tex:BitmapData = new BitmapData(512, 512, false, 0);
- tex.perlinNoise(25, 25, 8, 1, false, true, 7, true);
- tex.colorTransform(tex.rect, new ColorTransform(0.1, 0.1, 0.1, 1, 0, 0, 0, 0));
- var poolMaterial = new TextureMaterial(new BitmapTexture(tex));
- var bottomShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), poolThickness, planeSize -( poolThickness * 2));
- var leftShape : AWPBoxShape = new AWPBoxShape(poolThickness, planeSize, planeSize);
- var rightShape : AWPBoxShape = new AWPBoxShape(poolThickness, planeSize, planeSize);
- var backShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), planeSize, poolThickness);
- //var frontShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), planeSize, poolThickness);
- var bottom:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), poolThickness, planeSize -( poolThickness * 2)), poolMaterial);
- bottom.y = thickOffSet-sizeOffset;
- addChild(bottom);
- var left:Mesh = new Mesh(new CubeGeometry(poolThickness, planeSize, planeSize), poolMaterial);
- left.x = thickOffSet-sizeOffset;
- addChild(left);
- var right:Mesh = new Mesh(new CubeGeometry(poolThickness, planeSize, planeSize), poolMaterial);
- right.x = sizeOffset - thickOffSet;
- addChild(right);
- var back:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), planeSize, poolThickness), poolMaterial);
- back.z = sizeOffset-thickOffSet;
- addChild(back);
- var front:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), planeSize, poolThickness), poolMaterial);
- front.z = thickOffSet-sizeOffset;
- //addChild(front);
- var chairShape : AWPCompoundShape = new AWPCompoundShape();
- chairShape.addChildShape(bottomShape, new Vector3D(bottom.x,bottom.y,bottom.z), new Vector3D());
- chairShape.addChildShape(leftShape, new Vector3D(left.x,left.y,left.z), new Vector3D());
- chairShape.addChildShape(rightShape, new Vector3D(right.x,right.y,right.z), new Vector3D());
- chairShape.addChildShape(backShape, new Vector3D(back.x,back.y,back.z), new Vector3D());
- //chairShape.addChildShape(frontShape, new Vector3D(front.x,front.y,front.z), new Vector3D());
- body = new AWPRigidBody(chairShape, this, 30000);
- body.collisionFlags = AWPCollisionFlags.CF_CHARACTER_OBJECT;
- body.friction = .9;
- body.ccdSweptSphereRadius = 0.2;
- body.ccdMotionThreshold = 1;
- trace(body.mass);
- body.position = this.getPosition();
- Config.world.addRigidBody(body);
- }
- // Biscuit code
- var cubeTexture:BitmapCubeTexture = new BitmapCubeTexture(Cast.bitmapData(F1), Cast.bitmapData(F2), Cast.bitmapData(F3), Cast.bitmapData(F4), Cast.bitmapData(F5), Cast.bitmapData(F6));
- var material:ColorMaterial = new ColorMaterial(0xfc6a11);
- material.addMethod(new EnvMapMethod(cubeTexture, 1));
- //cube = new Mesh(new TorusGeometry(15,15,50), material);
- cube = new Mesh(new CubeGeometry(10,10,10), material);
- //(100, 30, 20, 10,true)
- //var bct:BitmapCubeTexture = new BitmapCubeTexture(new F1().bitmapData, new F2().bitmapData, new F3().bitmapData, new F4().bitmapData, new F5().bitmapData, new F6().bitmapData);
- //cube = new Mesh(new CubeGeometry(10,10,10), material);
- addChild(cube);
- //cube.
- cube.rotationX = 90;
- y = 200;
- z = 500;
- x = randomRange(265, -265);
- //var shape:AWPConeShape = new AWPConeShape(15, 15);
- var shape:AWPBoxShape = new AWPBoxShape(10, 10, 10);
- var body : AWPRigidBody = new AWPRigidBody(shape, this, 1);
- body.friction = .9;
- body.ccdSweptSphereRadius = 0.5;
- body.ccdMotionThreshold = 1;
- body.position = this.getPosition();
- Config.world.addRigidBody(body);
Advertisement
Add Comment
Please, Sign In to add comment