Advertisement
Guest User

Untitled

a guest
Jun 6th, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1.  
  2. code for the coockeis
  3.  
  4. cube = new Mesh(new CubeGeometry(10,10,10), material);
  5.  
  6. addChild(cube);
  7.  
  8.  
  9.  
  10. //cube.
  11. cube.rotationX = 90;
  12. y = 200;
  13. z = 500;
  14. x = randomRange(265, -265);
  15.  
  16. //var shape:AWPConeShape = new AWPConeShape(20, 5);
  17. var shape:AWPBoxShape = new AWPBoxShape(10,10,10);
  18. var body : AWPRigidBody = new AWPRigidBody(shape, this, .25);
  19.  
  20.  
  21. body.position = this.getPosition();
  22. body.ccdSweptSphereRadius = 0.5;
  23. body.ccdMotionThreshold = 1;
  24. Config.world.addRigidBody(body);
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32. //Code for Basket
  33.  
  34. var planeSize:Number = 50;
  35. var poolThickness:Number = 5;
  36. var thickOffSet:Number = poolThickness / 2;
  37. var sizeOffset:Number = planeSize / 2;
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45. var tex:BitmapData = new BitmapData(512, 512, false, 0);
  46. tex.perlinNoise(25, 25, 8, 1, false, true, 7, true);
  47. tex.colorTransform(tex.rect, new ColorTransform(0.1, 0.1, 0.1, 1, 0, 0, 0, 0));
  48. var poolMaterial = new TextureMaterial(new BitmapTexture(tex));
  49.  
  50. var bottom:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), poolThickness, planeSize -( poolThickness * 2)), poolMaterial);
  51. bottom.y = thickOffSet-sizeOffset;
  52. addChild(bottom);
  53.  
  54. var left:Mesh = new Mesh(new CubeGeometry(poolThickness, planeSize, planeSize), poolMaterial);
  55. left.x = thickOffSet-sizeOffset;
  56. addChild(left);
  57.  
  58. var right:Mesh = new Mesh(new CubeGeometry(poolThickness, planeSize, planeSize), poolMaterial);
  59. right.x = sizeOffset - thickOffSet;
  60. addChild(right);
  61.  
  62. var back:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), planeSize, poolThickness), poolMaterial);
  63. back.z = sizeOffset-thickOffSet;
  64. addChild(back);
  65.  
  66. var front:Mesh = new Mesh(new CubeGeometry(planeSize-(poolThickness * 2), planeSize, poolThickness), poolMaterial);
  67. front.z = thickOffSet-sizeOffset;
  68. addChild(front);
  69.  
  70.  
  71.  
  72. var bottomShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), poolThickness, planeSize -( poolThickness * 2));
  73. var leftShape : AWPBoxShape = new AWPBoxShape(poolThickness, planeSize, planeSize);
  74. var rightShape : AWPBoxShape = new AWPBoxShape(poolThickness, planeSize, planeSize);
  75. var backShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), planeSize, poolThickness);
  76. var frontShape : AWPBoxShape = new AWPBoxShape(planeSize-(poolThickness * 2), planeSize, poolThickness);
  77.  
  78. var chairShape : AWPCompoundShape = new AWPCompoundShape();
  79. chairShape.addChildShape(bottomShape, new Vector3D(bottom.x,bottom.y,bottom.z), new Vector3D());
  80. chairShape.addChildShape(leftShape, new Vector3D(left.x,left.y,left.z), new Vector3D());
  81. chairShape.addChildShape(rightShape, new Vector3D(right.x,right.y,right.z), new Vector3D());
  82. chairShape.addChildShape(backShape, new Vector3D(back.x,back.y,back.z), new Vector3D());
  83. chairShape.addChildShape(frontShape, new Vector3D(front.x,front.y,front.z), new Vector3D());
  84.  
  85.  
  86. body= new AWPRigidBody(chairShape, this,2000);
  87. body.friction = .9;
  88. body.ccdSweptSphereRadius = 0.5;
  89. body.ccdMotionThreshold = 1;
  90. body.position = this.getPosition();
  91. world.addRigidBody(body);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement