PhysicsTest.js 629 B

1234567891011121314151617181920212223242526272829303132333435
  1. "atomic component";
  2. var component = function (self) {
  3. var node = self.node;
  4. var body = node.createComponent("RigidBody2D");
  5. body.setBodyType(Atomic.BT_DYNAMIC);
  6. body.fixedRotation = true;
  7. body.bullet = true;
  8. body.castShadows = false;
  9. var circle = node.createComponent("CollisionCircle2D");
  10. // Set radius
  11. circle.setRadius(.5);
  12. // Set density
  13. circle.setDensity(1.0);
  14. // Set friction.
  15. circle.friction = .2;
  16. // Set restitution
  17. circle.setRestitution(0.1);
  18. self.start = function() {
  19. }
  20. self.update = function(timeStep) {
  21. }
  22. }
  23. exports.component = component;