3

I'm learning new javascript lib PhysicsJS (link).

If anybody can help me or show me example of:

How to rotate fixed object (like propeller and balls bounce of it)?

How to set in world some object that bounce with object that not bounce?

Edge-collision-detection (AABB) , Is it possible to do a circle instead of the cube?

tshepang
  • 12,111
  • 21
  • 91
  • 136
Gleda
  • 31
  • 3

2 Answers2

1

You can rotate objects by changing angular property like this:

world.on('step', function(){
  barrel.state.angular.pos += 0.02;
  world.render();
});
0

Your question about rotating a "fixed" object was asked in another post: PhysicsJS - how to create a body which rotates about a fixed point when struck?

As for setting some objects that bounce and some that don't: This can't be done yet. It's being worked out as part of future development: https://github.com/wellcaffeinated/PhysicsJS/issues/30

For edge collision detection, right now it's only possible to use rectangles. You would have to modify the edge collision detection code to make it a circle.

Community
  • 1
  • 1
Jasper
  • 1,193
  • 1
  • 9
  • 14
  • Example for fixed object is good but as I wrote, it is necessary to work as a propeller. Propeller should push the ball. – Gleda Nov 24 '13 at 00:12