New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ghost-body

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ghost-body

p2 add-on for bodies that detect collision but have no collision response.

latest
Source
npmnpm
Version
2.2.0
Version published
Weekly downloads
4
-42.86%
Maintainers
1
Weekly downloads
 
Created
Source

ghost-body

p2 add-on for bodies that detect collision but have no collision response.

What this does

A ghost body will not bounce off of or have friction with other bodies. You can still react to a ghost overlapping other bodies via World's beginContact event.

Ghost bodies fire events when other bodies enter/exit them.

API

ghostBody.enable(World)

Enables a World to have ghost bodies. Call this once per World.

ghostBody.disable(World)

Disables ghost bodies in a World.

ghostBody.ghostify(Body)

Turn on ghost mode for a Body. Call this once on every Body that needs ghost treatment.

ghostBody.unghostify(Body)

Turn off ghost mode for a Body.

ghostBody.isGhost(Body)

See if Body is a ghost.

Events

Events are fired by ghost bodies using p2's built-in event system.

bodyEntered

Fired when a body enters a ghost body.

ghost.on('bodyEntered', function(event) {
  // number of bodies currently overlapping ghost
  event.count
  // body that entered
  event.causedBy
});

populated

Fired when a body enters a ghost body that was empty.

ghost.on('populated', function(event) {
  // number of bodies currently overlapping ghost
  event.count
  // body that entered
  event.causedBy
});

bodyExited

Fired when a body leaves a ghost body.

ghost.on('bodyExited', function(event) {
  // number of bodies currently overlapping ghost
  event.count
  // body that exited
  event.causedBy
});

emptied

Fired when the last body leaves a ghost body.

ghost.on('emptied', function(event) {
  // number of bodies currently overlapping ghost
  event.count
  // body that exited
  event.causedBy
});

Install

npm install ghost-body

License

MIT

Keywords

p2

FAQs

Package last updated on 13 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts