Guest User

Untitled

a guest
Jun 18th, 2014
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. private function createPool():void {
  2. var planeSize:Number = 50;
  3. var poolThickness:Number = 5;
  4. var thickOffSet:Number = poolThickness / 2;
  5. var sizeOffset:Number = planeSize / 2;
  6.  
  7. var tex:BitmapData = new BitmapData(512, 512, false, 0);
  8. tex.perlinNoise(25, 25, 8, 1, false, true, 7, true);
  9. tex.colorTransform(tex.rect, new ColorTransform(0.1, 0.1, 0.1, 1, 0, 0, 0, 0));
  10. var poolMaterial = new TextureMaterial(new BitmapTexture(tex));
  11.  
  12. var bottomShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), poolThickness, planeSize -( poolThickness * 2));
  13.  
  14. var leftShape : AWPBoxShape = new AWPBoxShape(poolThickness, planeSize, planeSize);
  15. var rightShape : AWPBoxShape = new AWPBoxShape(poolThickness, planeSize, planeSize);
  16. var backShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), planeSize, poolThickness);
  17. //var frontShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), planeSize, poolThickness);
  18.  
  19.  
  20. var bottom:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), poolThickness, planeSize -( poolThickness * 2)), poolMaterial);
  21. bottom.y = thickOffSet-sizeOffset;
  22. addChild(bottom);
  23.  
  24. var left:Mesh = new Mesh(new CubeGeometry(poolThickness, planeSize, planeSize), poolMaterial);
  25. left.x = thickOffSet-sizeOffset;
  26. addChild(left);
  27.  
  28. var right:Mesh = new Mesh(new CubeGeometry(poolThickness, planeSize, planeSize), poolMaterial);
  29. right.x = sizeOffset - thickOffSet;
  30. addChild(right);
  31.  
  32. var back:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), planeSize, poolThickness), poolMaterial);
  33. back.z = sizeOffset-thickOffSet;
  34. addChild(back);
  35.  
  36. var front:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), planeSize, poolThickness), poolMaterial);
  37. front.z = thickOffSet-sizeOffset;
  38. //addChild(front);
  39.  
  40.  
  41.  
  42.  
  43.  
  44. var chairShape : AWPCompoundShape = new AWPCompoundShape();
  45. chairShape.addChildShape(bottomShape, new Vector3D(bottom.x,bottom.y,bottom.z), new Vector3D());
  46. chairShape.addChildShape(leftShape, new Vector3D(left.x,left.y,left.z), new Vector3D());
  47. chairShape.addChildShape(rightShape, new Vector3D(right.x,right.y,right.z), new Vector3D());
  48. chairShape.addChildShape(backShape, new Vector3D(back.x,back.y,back.z), new Vector3D());
  49. //chairShape.addChildShape(frontShape, new Vector3D(front.x,front.y,front.z), new Vector3D());
  50.  
  51.  
  52. body = new AWPRigidBody(chairShape, this, 30000);
  53. body.collisionFlags = AWPCollisionFlags.CF_CHARACTER_OBJECT;
  54. body.friction = .9;
  55.  
  56. body.ccdSweptSphereRadius = 0.2;
  57. body.ccdMotionThreshold = 1;
  58. trace(body.mass);
  59. body.position = this.getPosition();
  60. Config.world.addRigidBody(body);
  61.  
  62.  
  63. }
  64.  
  65.  
  66.  
  67. // Biscuit code
  68.  
  69. var cubeTexture:BitmapCubeTexture = new BitmapCubeTexture(Cast.bitmapData(F1), Cast.bitmapData(F2), Cast.bitmapData(F3), Cast.bitmapData(F4), Cast.bitmapData(F5), Cast.bitmapData(F6));
  70.  
  71. var material:ColorMaterial = new ColorMaterial(0xfc6a11);
  72. material.addMethod(new EnvMapMethod(cubeTexture, 1));
  73. //cube = new Mesh(new TorusGeometry(15,15,50), material);
  74.  
  75. cube = new Mesh(new CubeGeometry(10,10,10), material);
  76. //(100, 30, 20, 10,true)
  77.  
  78. //var bct:BitmapCubeTexture = new BitmapCubeTexture(new F1().bitmapData, new F2().bitmapData, new F3().bitmapData, new F4().bitmapData, new F5().bitmapData, new F6().bitmapData);
  79. //cube = new Mesh(new CubeGeometry(10,10,10), material);
  80.  
  81. addChild(cube);
  82.  
  83.  
  84.  
  85. //cube.
  86. cube.rotationX = 90;
  87. y = 200;
  88. z = 500;
  89. x = randomRange(265, -265);
  90.  
  91. //var shape:AWPConeShape = new AWPConeShape(15, 15);
  92. var shape:AWPBoxShape = new AWPBoxShape(10, 10, 10);
  93. var body : AWPRigidBody = new AWPRigidBody(shape, this, 1);
  94. body.friction = .9;
  95.  
  96. body.ccdSweptSphereRadius = 0.5;
  97. body.ccdMotionThreshold = 1;
  98.  
  99. body.position = this.getPosition();
  100.  
  101. Config.world.addRigidBody(body);
Advertisement
Add Comment
Please, Sign In to add comment