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
2
votes
1 answer

Box2D - collect a coin

I'm fairly new to Box2D and I'm trying to make a simple game where a character jumps and picks a coin. I was able to create a contact listener and delete the coin when the contact was detected. The problem is that character and coin collided. I was…
adam
  • 807
  • 3
  • 11
  • 17
2
votes
1 answer

Box2dWeb missing ApplyLinearImpuse() and ApplyAngularImpulse() methods?

I have been trying to get to grips with HTML5 game writing coming from an XNA / Farseer background. It seems that box2dweb is missing ApplyLinearImpuse() and ApplyAngularImpulse() methods. I have even looked at the source here and it seems to be…
Techlead
  • 172
  • 1
  • 10
1
vote
1 answer

Drawing collider boundaries (box2d-wasm). Error: Cannot construct a b2Draw, no constructor in IDL

I try to use the box2d-wasm package. I successfully run a program that prints a vector: https://plnkr.co/edit/6dTVT4HtFW4wf15H Document
8Observer8
  • 868
  • 10
  • 17
1
vote
0 answers

javascript games ThreeJS and Box2D conflicts?

I've been trying to experiment with box2d and threejs. So box2d has a series of js iterations, I've been successful at using them so far in projects as well as threejs in others, but I'm finding when including the latest instance of threejs and…
1
vote
0 answers

Node.js app is working slow after 24 hours, what might be the reasons?

I' am working on multiplayer game and server side is written with node.js with box2dweb. Server is on aws it's ubuntu 15 LTS (1GB RAM) virtual machine. Game is running fine when i start it within firs couple of hours, but after ~24h game is slowing…
peterSweter
  • 633
  • 6
  • 23
1
vote
0 answers

Revolute joint with box2d web, wheel not turning around own axis

I am trying to use revolute joints in node.js server, but my wheel is not turining around its own axis but around body. Here is my code: var joint_def = new b2RevoluteJointDef(); joint_def.Initialize(this.body , wheel,…
peterSweter
  • 633
  • 6
  • 23
1
vote
0 answers

Unexplained HTML5 lag on AMD processors

I'm working on a CPU-intensive HTML5 canvas game that uses Createjs and Box2D.js The game runs at half the frame rate on AMD-processor computers compared to similar spec Intel ones and I can't figure out why. Is there any reason why CPU architecture…
1
vote
0 answers

Implementing box2d debug draw with pixijs?

I have used box2d in flash. I am trying to implement it for an html5 game. I intend to use pixijs as rendering engine for my game. Does anybody know how to get the debug draw working for pixijs. While googling the topic I cam across…
chandings
  • 549
  • 3
  • 9
  • 23
1
vote
0 answers

Three.js keeps displaying the same geometry

I have a simple Three.js code that works properly in Three.js v68 but it displays 2 cubes instead of a cube and a sphere in Three.js v71. If I draw the sphere first it will draw two spheres. var scene = new THREE.Scene(); var camera…
ruff
  • 61
  • 1
  • 1
  • 3
1
vote
1 answer

Box2d DebugDraw in Cocos2djs

I am trying to get box2d debugdaw working in cocos2djs. The following code for me just runs the game normally without any errors or debug shapes. Where am I going wrong? var b2Vec2 = Box2D.Common.Math.b2Vec2 , b2World = Box2D.Dynamics.b2World …
Zain
  • 85
  • 1
  • 7
1
vote
2 answers

Calculate speed from velocity vector using box2d GetLinearVelocity();

I need to find the speed of an object in a game. The game is made in HTML5 with jquery and jquery.box2d. For this I can use these methods: GetLinearVelocity().x; GetLinearVelocity().y; I'm then trying to calculate the speed from this piece of…
Tommy Otzen
  • 190
  • 1
  • 16
1
vote
1 answer

Console.log object velocity with box2d

I'm trying to console.log the velocity of an object with box2dweb It should be possible to get velocity with following method GetLinearVelocity() but I'm not sure how to do? I've tried the following ways: var heroMove =…
Tommy Otzen
  • 190
  • 1
  • 16
1
vote
1 answer

Box2DWeb b2EdgeShape

How to make a b2EdgeShape? Making a simple b2EdgeShape. Simple boilerplate b2EdgeShape to build on top of. My code: var bodyDef = new Box2D.Dynamics.b2BodyDef; bodyDef.type = Box2D.Dynamics.b2Body.b2_staticBody; bodyDef.position.SetV(new…
L2L2L
  • 83
  • 2
  • 10
1
vote
1 answer

implementing a boundary listener in box2dweb

I am relatively new to box2d, I'm using the box2dweb version. I want to be able to detect when kinematic bodies have exited the boundaries of my stage. The Box2D.Dynamics.b2BoundaryListener is the obvious answer, but it is apparently not supported…
1
vote
1 answer

Box2d: Starting angle of revolute joint

I was under the impression that to start a body at a specified angle of a revolute joint you set the referenceAngle. This isn't working for me. The only thing changing when altering referenceAngle is the position of the limits. I am using box2dweb…
Brimby
  • 847
  • 8
  • 25