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
1
vote
2 answers

Why does my function return undefined?

With easeljs and box2d I have created several objects which collide with each other. Using the following code I create a box on the screen: var b = new Box(400,0); // pass xPos and yPos stage.addChild(b.view); At a certain point in my script the…
Tomjesch
  • 492
  • 4
  • 27
1
vote
1 answer

Determine which direction is down on mobile device in javascript?

I am creating a tool using Box2D and wanted to see if there was a way to match the direction of the real force of gravity acting on a mobile device. I've got this completely working on iPad by binding to the devicemotion event. I check to see if the…
itsmequinn
  • 1,054
  • 1
  • 8
  • 21
1
vote
1 answer

mouseJoint box2dweb doesn't work

I am trying to catch object with mouse using mousejoint. As I am a fool I've stolen the code. But it isnt working or me. I am getting this errors: Uncaught TypeError: Object #< ba > has no method 'IsActive' Box2dWeb-2.1.a.3.min.js:236 Uncaught…
Falk
  • 621
  • 2
  • 9
  • 23
1
vote
1 answer

Box2d-Web with Meteor

I want to use Box2D-Web with Meteorjs on both client and server side. I used this in nodejs. There was a small configuration that exports Box2D variable, and it was working with nodejs. The additional configuration was exports.Box2D = Box2D; at…
Ahmet DAL
  • 4,445
  • 9
  • 47
  • 71
1
vote
0 answers

Can't move when use box2D in JavaScript

i use Crafty engine, i use Twoway to move my player by key, but when i use box2D, my player can't move, someone can help me? Crafty.c('Player', { currentAnim: null, init: function() { this.requires('2D, Canvas, spr_zoro_stand,…
1
vote
1 answer

Move and rotate animation at same using CSS3 and Javascript

I am having some fun with box2dweb. The following code is located in my step method which gets called about 30/sec, the code works but a am curios if there is a way of improving it? var img = body.GetUserData(); var pos =…
Ivan Bacher
  • 5,855
  • 9
  • 36
  • 56
1
vote
1 answer

undefined is not a function when evaluating 'this.batman()'

I'm trying to use coffeescript with box2dweb to create a simple game. Setting up the physics works fine and updates fine but when it comes to trying to call my own functions in the update loop I get this error 'undefined is not a function…
1
vote
0 answers

How can I delete objects from memory in JavaScript?

I am using EaselJS and Box2DWeb to create an arrow shooting game. Every time an arrow collides with another body, it dies, and I call this function: if(body.dead){ removeActor(body.GetUserData()) //the user data is the actor object (sprite) of…
1
vote
0 answers

Maintain constant velocity of objects after collision

I have several circles moving around. I set the linearVelocity of each circle. But when they collide, their velocities change. Sometimes, the vertical or horizontal or both components of the velocity become zero and the circle doesn't move. I've the…
Abdulsattar Mohammed
  • 10,154
  • 13
  • 52
  • 66
1
vote
1 answer

Box2dweb prohibit movement

I have now created a object in box2d and I am moving it using keyboard input. What I would like to do next is stop the vertical movement this body can have. In other words it should be able to move left and right, but not up and down, even when a…
Morne
  • 1,623
  • 2
  • 18
  • 33
1
vote
1 answer

IE10 laggy rendering for rapid positioning changes

I am creating a rendering engine for box2djs that uses elements on the page to render rather than canvas, because it is much easier to style and manipulate elements than it is to implement the same effects on Canvas. Anyways, Chrome (best as always)…
howderek
  • 2,224
  • 14
  • 23
1
vote
0 answers

making a joint (Distance,Revolute..) with Box2dweb and CreateJS

I found this cool tutorial about using Box2dweb in CreateJS http://gotoandlearn.com/play.php?id=176 I m trying to make any joint but no luck, please help.
Methnani Bilel
  • 1,366
  • 4
  • 20
  • 34
1
vote
0 answers

Box2D b2.ContactListener strangeness

I've been using Jonas Wagner's JS Box2D port and am running into a strange problem with shape userdata. I've setup my entity to have a collision shape as well as a secondary 'foot' sensor shape to determine when my object is on solid ground. The…
ndg
  • 2,585
  • 2
  • 33
  • 58
1
vote
1 answer

Box2dWeb dynamic vs static bodies restitution

I've got a Box2dWeb simulation with some dynamic bodies. I used the same fixture for all dynamic bodies like this: var fixDef = new b2FixtureDef; fixDef.density = 1.0; fixDef.friction = 0.1; fixDef.restitution = 0; I thought restitution set to 0…
lelloman
  • 13,883
  • 5
  • 63
  • 85
0
votes
0 answers

Box2D / Javascript - How to change position of an object?

How do I change the position of a body element programatically? I've tried body.SetPosition( 0, 0 ); body.SetPosition( { x: 0, y: 0 } ); body.SetPosition( ).x = 0; body.SetPosition( ).y = 0; None of the tutorials seem to cover this either - they…
Vardan Betikyan
  • 354
  • 5
  • 20