A modular, extendable, and easy-to-use physics engine for JavaScript.
Questions tagged [physicsjs]
47 questions
11
votes
3 answers
Why gravity acceleration is 0.0004 in PhysicsJS?
Or, perhaps, better, what does it mean?
What the units are supposed be?
If I'm trying to simulate friction against the "background", like this:
return this
.velocityDirection
.mult(mu * this.mass * g)
.negate();
I expect to use g as…

slacktracer
- 6,262
- 6
- 28
- 33
9
votes
2 answers
How to solve peerinvalid errors in npm install?
I'm trying to follow the steps to contribute to PhysicsJS (https://github.com/wellcaffeinated/PhysicsJS#contributing) and having the following error during npm install.
npm ERR! peerinvalid The package grunt-contrib-jasmine does not satisfy its…

slacktracer
- 6,262
- 6
- 28
- 33
7
votes
1 answer
How to make a realistic roulette ball spinning animation
I'm using PhysicsJS to make a 2D roulette ball spinning animation.
So far, I've implemented the following:
used a constraint so that the ball wouldn't "fly away":
rigidConstraints.distanceConstraint( wheel, ball, 1 );
used drag to slow down the…

Razor
- 27,418
- 8
- 53
- 76
4
votes
1 answer
How to setup interactive and non-interactive objects in PhysicsJS?
I am trying to setup a seesaw with userdragable objects. After world creation in PhysicsJS, mouse drag interaction is added by
world.add( Physics.behavior('interactive', { el: renderer.el }) );
which works fine. Subsequently, I want some added…

alex
- 2,464
- 23
- 32
3
votes
1 answer
PhysicsJS - Creating rope & attach something at the end of it
Question #1:
I'm new to PhysicsJS, and i tried to create a rope with idea of "Basket of verlet constraints"
something like this: JSFiddle
as you see, this rope is not acting natural! (friction, rope wight, stability time & ...)
and by increasing…

MeTe-30
- 2,512
- 2
- 21
- 30
3
votes
2 answers
PhysicsJS Friction Behavior
I am new to physicsjs and am creating some test simulations in order to become familiar with the library.
I want to simulate multiple boxes sliding across the screen which all experience different degrees of friction. So far I have 3 boxes which…

lufthansa747
- 1,923
- 3
- 26
- 39
3
votes
2 answers
How to rotate fixed object using PhysicsJS?
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…

Gleda
- 31
- 3
2
votes
2 answers
Use sensors to change gravity in physics engine
I'm searching for a way to use sensors in a mobile device (in a Cordova app) to change the behavior of the physics engine.
Currently playing around with PhysicsJS, but also found matter.js as a candidate for the physics engine.
In the first step,…

hgoebl
- 12,637
- 9
- 49
- 72
2
votes
1 answer
Resolving external submodule dependences in webpack
I am trying to include a modular third-party library (PhysicsJS) into my webpack project. This library is AMD- and CommonJS-friendly, and has well-formed submodules that I want to access. However it is primarily structured for RequireJS, via its…

Andrew
- 14,204
- 15
- 60
- 104
2
votes
1 answer
How to use two images in physicsjs
I made a simple "animation" with PhysicsJS, where I have this body:
balon = Physics.body('circle', {
x: 50,
y: random(20, 350),
vx: 0.45,
angle:…

Russo
- 301
- 3
- 12
2
votes
0 answers
PhysicsJS - spinning aggregates of newtonian bodies
I've been playing with PhysicsJS and noticed some odd behavior with bodies that attract each other using the 'newtonian' behavior.
One example of this behavior is on the "Newton's Revenge" demo. At first, all the bodies start to glom together as…

dandelany
- 71
- 3
2
votes
1 answer
Physicsjs Screen wrap
I am currently having a bit of trouble making objects in my world wrap. It sort of works, but very often objets appear to get stuck on the boundaries. My wrap code is as follows:
// Wrap our position if we are outside of the world bounds
…

Jozef
- 523
- 6
- 8
2
votes
1 answer
Did drag setting changed in PhysicsJS?
I can see drag working in this fiddle using PhysicsJS 0.5.2: http://jsfiddle.net/slacktracer/z7DmA/ but it doesn't work using 0.6.0: http://jsfiddle.net/slacktracer/z7DmA/5/.
Both should have the same drag:
world.add(Physics.integrator('verlet', {
…

slacktracer
- 6,262
- 6
- 28
- 33
2
votes
2 answers
PhysicsJS - how to create a body which rotates about a fixed point when struck?
I've been experimenting with the excellent PhysicsJS library, especially constraints and collisions. What I'm trying to achieve is a polygon which can spin about a fixed rotation point. As a real world example, imagine a wide shelf nailed to a wall…

Tom W Hall
- 5,273
- 4
- 29
- 35
1
vote
0 answers
I want to make a html element animation a javascript variable so i can add physics to it
So here is some simple physicsjs and I have a css animation that is called by divs in my index file. So the main goal of this project is to have the walls come in and bounce the ball around also the walls cant collide with any other walls or it will…

Dan
- 34
- 3