Questions tagged [physicsjs]

A modular, extendable, and easy-to-use physics engine for JavaScript.

47 questions
0
votes
0 answers

Attract one set of bodies to another set of bodies, but not to other bodies in the same set

I'm looking to implement a planet-like system, whereby you have large, mostly-fixed objects which have lots of smaller objects around them. The idea is that the smaller objects could orbit around the larger objects, but also change which of the…
Daniel Samuels
  • 423
  • 7
  • 25
0
votes
1 answer

physics.js attractors, zero gravity and slowing down velocity

I've been experimenting with attractors in physics.js, rigging up a simple object in zero gravity, with an attractor at a point. This creates a great little 'gravity well' as can be seen here. Where the simple square vector attracts towards a point,…
0
votes
2 answers

Move a body by changing its position using PhysicsJS

I was able to move a body to an specific point by changing its state.pos AND its state.old.pos. But it seems to lose its velocity (and acceleration I suppose). Doing it like this: ship.body.state.pos.x = -context.width / 2 -…
slacktracer
  • 6,262
  • 6
  • 28
  • 33
0
votes
0 answers

I cannot get an example to run with physics.js 0.7.0

I found this example that works for physics.js 0.6.0 http://jsfiddle.net/REGCU/22/ but I cannot get it to work with 0.7.0 http://jsfiddle.net/REGCU/23/ javascript: Physics(function (world) { var viewWidth = window.innerWidth …
0
votes
1 answer

Allowing specific bodies to collide with edges but not with other fixed bodies

I'm using the edge-collision-detection behavior to add collisions with the edge of the viewport, and the body-impulse-response behavior to respond to these collisions so the colliding bodies will bounce off the "walls". However, I can't seem to make…
bartzy
  • 328
  • 5
  • 14
0
votes
1 answer

Generate a masonry layout and then apply gravity to it

Here's a weird one that I've been wracking my brain on. I want to do two things, in order: Generate a masonry-style layout from a list of divs, imgs, or whatever. These will utilize images but they can be background images, within the divs, or…
ennuipreneur
  • 13
  • 1
  • 5
0
votes
1 answer

making a body at fixed location in Physicsjs

require.config({ baseUrl: 'http://wellcaffeinated.net/PhysicsJS/assets/scripts/vendor/', packages: [ { name: 'physicsjs', location: 'physicsjs-current', main: 'physicsjs-full.min' } ] }); var colors = [ …
asadkaramat
  • 109
  • 1
  • 2
  • 8
0
votes
0 answers

PhysicsJS: Body is clinging to the corner of another body while sliding down

So, I'm making a small 2D platformer. I have a flat "tower" of several static blocks standing on each other and one another dynamic body (the player) which jumps to the top of the tower and sliding down, colliding with it. But sliding is very rough,…
Kirill Rogovoy
  • 583
  • 3
  • 11
0
votes
1 answer

Stop Body Rotation in PhysicsJS

I'm looking for the best practice approach to stop PhysicsJS bodies from being able to rotate. I have tried cancelling the body's rotational velocity. Yet this does not seem effective on the step as the body still somehow sneaks in some rotation.…
Rohan
  • 456
  • 3
  • 16
0
votes
0 answers

rotate on the y axes with javascript

this is a copy from another question, I try to modified it to rotate on the y axes--not so much for a 3d view, but as a flip, like a card, or a page-- but I can't seem to figure it out, I triad the api reference and documentation, but it's mostly…
L2L2L
  • 83
  • 2
  • 10
0
votes
1 answer

Physicsjs getTarget is undefined

I'm trying to make a custom behavior and I'm not very familiar with physicsjs. According to the docs in github I'm supposed to use var bodies = this.getTargets(); to iterate through the bodies , but I keep getting an undefined is not a function…
GuiDocs
  • 722
  • 1
  • 6
  • 12
0
votes
1 answer

PhysicsJS Basic Demo Fail

I'm trying to get the basic demo going for PhysicsJS but I'm getting results that I do not understand. I have a one page HTML file as follows... PhysicsJS