Questions tagged [box2dweb]

Box2dWeb is port of box2dFlash port to javascript.

Box2dWeb is a physics engine and it's basically a port of Box2DFlash library to JavaScript.

95 questions
0
votes
1 answer

Box2D body with b2FixtureDef.shape.SetAsArray not working with tetris-like shapes

I tried to model a tetris shape with the SetAsArray function of box2d. But the shapes are not colliding correctly with other bodies, sometimes falling through, sometimes diving in. No problems with square or circle shapes. …
Michael
  • 6,823
  • 11
  • 54
  • 84
0
votes
1 answer

Use Box2d with EaselJS Shapes?

I'm trying to learn Box2d and EaselJS. So far, I've been working with the "debug" shapes of Box2d. How can I make custom shapes from EaselJS, physics enabled? For example, I have the following code to spawn random balls on the screen. var fixDef =…
user2200321
  • 325
  • 1
  • 4
  • 18
0
votes
1 answer

Box2dWeb call function when objects collide

I'm fairly new to javascript and box2d, i was wondering if someone knows how i can call a custom function when two objects collide. I tried using some examples that uses the b2ContactListener without any succes. I've placed an object above another…
Tomjesch
  • 492
  • 4
  • 27
0
votes
2 answers

Box2D: How to listen to bodies added to or remove from world?

In Box2D how can I listen to bodies added to or remove from world? I want to use them for debugging.
Ali Shakiba
  • 20,549
  • 18
  • 61
  • 88
0
votes
1 answer

When creating a joint during runtime, object teleports

I have two objects and when the distance between them is less than 10, I create a joint: var joint_def = new box2d.b2RevoluteJointDef(); joint_def.bodyA = body1; joint_def.bodyB = body2; joint_def.localAnchorA = new box2d.b2Vec2(0,…
Rok Povsic
  • 4,626
  • 5
  • 37
  • 53
0
votes
1 answer

Sprites misaligned with bodies, can't find bug in the display loop

I'm currently creating a game with box2Dweb. Whenever my shapes move toward the bottom-right corner of the canvas, their sprite seems to move with some offset that grows bigger and bigger (and if I move the shape toward the top left corner of the…
Valentin Roudge
  • 555
  • 4
  • 14
0
votes
0 answers

Box2dweb & Canvas - How to get a callback regarding a shapes current position, and use it to detect if a player has won?

I am trying to make a small physics game to understand box2dweb better. I want the game to be able to detect when a certain shape, is in contact with a certain sensor or body. Which I can then use to determine if the player has won or not. There…
0
votes
2 answers

Box2dweb: add images to shapes

i'm really struggling to add images to a shape using jquery and box2dweb. my code is based on a great example here: http://henry.brown.name/experiments/box2d/bricks.php with the image binding taken from here:…
Vauneen
  • 147
  • 3
  • 13
0
votes
1 answer

How to detect collision of animating ccsprite in box2d

I am making one game where a character has some animations like run, jump etc., Is there any way to detect collision while it is animating? Because it is changing its shape while in idle state, running, and jumping state. While I searched for…
Kumar C
  • 525
  • 6
  • 21
0
votes
1 answer

Box2dWeb reset level

My question is simple: How can I reset or restart a world in Box2dWeb? I need to do this when the player reloads the level he is playing.
Sony packman
  • 810
  • 2
  • 10
  • 21
0
votes
1 answer

Box2DWeb, PolygonShape.SetAsVector not detect collision

Here's the prolem If I define the baseball bat with SetAsBox the no problem. This kind of weird happens when I define it using SetAsVector this.view = new createjs.Bitmap("hammer.png"); this.view.regX = 0; this.view.regY = 0; var fixDef = new…
Thịnh Phạm
  • 2,528
  • 5
  • 26
  • 39
0
votes
1 answer

Create Box2dWeb obstacle from svg coordinates

I'm trying to create some terrain for my Box2dWeb -game. After reading the rather tiny documentation for Box2DWeb I am unsure if I can create long edge chains from a set of coordinates. I think the box2d feature for this is called "chain shapes" but…
Sony packman
  • 810
  • 2
  • 10
  • 21
0
votes
1 answer

How to use "applyforce" to blow the objects to a direction?

i'm learning box2dweb with html5, and i'm trying to use applyforce to objects when the circle and square almost near the ground, how to do that? test
hkguile
  • 4,235
  • 17
  • 68
  • 139
0
votes
2 answers

why does bounce increase in box2d when restitution=1

I have created a dynamic circle inside a static box (four static walls to make a box). applied negative gravity to the world. now the effect is the circular body should bounce off inner walls and eventually stabilize. with restituion=1 the effect…
maheshg
  • 339
  • 2
  • 7
  • 17
0
votes
1 answer

Box2d javascript add images to bodies and manage art assets

OK so I have a few levels of a simple platform built out, so I just need some insight on how to assign images to bodies, and handle images, etc. The game is a simple platform game, with a ball as the palyer chacter and you have to try to…
naed11
  • 13
  • 5