Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

p2-es

Package Overview
Dependencies
Maintainers
3
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p2-es - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

31

CHANGELOG.md
# `p2-es` Changelog
## 1.0.2
### Patch Changes
- b013bdc: Small refactor of World constructor
- 507efad: Add missing explicit return types
- ead1402: Fix undefined World sleep type statics
- f5f257c: Export Vec2 type
## v1.0.1
- Update version export
- Update version export
## v1.0.0
- Use typescript, include generated type definitions (@isaac-mason)
- Export as esm and cjs flatbundle (@isaac-mason)
- Fix bug setting frictionIterations in GSSolver, and where bodies with constraint could be removed from world. (@JSideris) (https://github.com/schteppe/p2.js/pull/360)
- Add `upperLimit` and `lowerLimit` to DistanceConstraint options (@DominicRoyStang) (https://github.com/schteppe/p2.js/pull/341)
- Fix World.step reverting to fixed time step with `timeSinceLastCalled` equal to `0` (@Grimeh) (https://github.com/schteppe/p2.js/pull/337)
- Fix EventEmitter bug causing listeners to receive incorrect events (@Fxlr8) (https://github.com/schteppe/p2.js/pull/336)
- Fix typo in AABB docs (@yzpeninsula) (https://github.com/schteppe/p2.js/pull/331)
- Fix incorrect fraction in `Line.raycast` (@palra) (https://github.com/schteppe/p2.js/pull/342)
- Use typescript, include generated type definitions (@isaac-mason)
- Export as esm and cjs flatbundle (@isaac-mason)
- Fix bug setting frictionIterations in GSSolver, and where bodies with constraint could be removed from world. (@JSideris) (https://github.com/schteppe/p2.js/pull/360)
- Add `upperLimit` and `lowerLimit` to DistanceConstraint options (@DominicRoyStang) (https://github.com/schteppe/p2.js/pull/341)
- Fix World.step reverting to fixed time step with `timeSinceLastCalled` equal to `0` (@Grimeh) (https://github.com/schteppe/p2.js/pull/337)
- Fix EventEmitter bug causing listeners to receive incorrect events (@Fxlr8) (https://github.com/schteppe/p2.js/pull/336)
- Fix typo in AABB docs (@yzpeninsula) (https://github.com/schteppe/p2.js/pull/331)
- Fix incorrect fraction in `Line.raycast` (@palra) (https://github.com/schteppe/p2.js/pull/342)
## v0.7.3
- Update type definitions (@joergjaeckel)
- Add MaterialOptions type (@joergjaeckel)
- Update type definitions (@joergjaeckel)
- Add MaterialOptions type (@joergjaeckel)

@@ -130,6 +130,6 @@ declare module "types/index" {

private listeners;
on<E extends keyof EventMap>(type: E, listener: (e: EventMap[E]) => void, context?: any): this;
on<E extends keyof EventMap>(type: E, listener: (e: EventMap[E]) => void, context?: any): EventEmitter<EventMap>;
off<E extends keyof EventMap>(type: E, listener: Function): EventEmitter<EventMap>;
has<E extends keyof EventMap>(type: E, listener?: Function): boolean;
emit<E extends keyof EventMap>(event: EventMap[E]): this;
emit<E extends keyof EventMap>(event: EventMap[E]): EventEmitter<EventMap>;
}

@@ -456,5 +456,5 @@ }

abstract destroy(object: T): void;
resize(size: number): this;
resize(size: number): Pool<T>;
get(): T;
release(object: T): this;
release(object: T): Pool<T>;
}

@@ -802,4 +802,4 @@ }

static NO_SLEEPING: number;
static BODY_SLEEPING: 2;
static ISLAND_SLEEPING: 4;
static BODY_SLEEPING: number;
static ISLAND_SLEEPING: number;
springs: Spring[];

@@ -1358,2 +1358,3 @@ bodies: Body[];

export * from "solver/Solver";
export * from "types/index";
export * from "utils/ContactEquationPool";

@@ -1360,0 +1361,0 @@ export * from "utils/FrictionEquationPool";

{
"name": "p2-es",
"version": "1.0.1",
"version": "1.0.2",
"license": "MIT",

@@ -40,3 +40,6 @@ "description": "A JavaScript 2D physics engine.",

"prettier": "prettier --list-different .",
"prettier-fix": "prettier --write ."
"prettier-fix": "prettier --write .",
"change": "yarn changeset",
"bump": "yarn changeset version",
"publish": "yarn changeset publish"
},

@@ -54,2 +57,3 @@ "repository": {

"@babel/preset-typescript": "^7.16.5",
"@changesets/cli": "^2.22.0",
"@rollup/plugin-babel": "^5.3.0",

@@ -56,0 +60,0 @@ "@rollup/plugin-json": "^4.1.0",

@@ -54,4 +54,6 @@ # p2-es

```js
import * as p2 from 'p2-es'
// Create a physics world, where bodies and constraints live
var world = new p2.World({
const world = new p2.World({
gravity: [0, -9.82],

@@ -61,3 +63,3 @@ })

// Create an empty dynamic body
var circleBody = new p2.Body({
const circleBody = new p2.Body({
mass: 5,

@@ -68,3 +70,3 @@ position: [0, 10],

// Add a circle shape to the body
var circleShape = new p2.Circle({ radius: 1 })
const circleShape = new p2.Circle({ radius: 1 })
circleBody.addShape(circleShape)

@@ -77,6 +79,6 @@

// Create an infinite ground plane body
var groundBody = new p2.Body({
const groundBody = new p2.Body({
mass: 0, // Setting mass to 0 makes it static
})
var groundShape = new p2.Plane()
const groundShape = new p2.Plane()
groundBody.addShape(groundShape)

@@ -87,5 +89,5 @@ world.addBody(groundBody)

// The World will run substeps and interpolate automatically for us, to get smooth animation.
var fixedTimeStep = 1 / 60 // seconds
var maxSubSteps = 10 // Max sub steps to catch up with the wall clock
var lastTime
const fixedTimeStep = 1 / 60 // seconds
const maxSubSteps = 10 // Max sub steps to catch up with the wall clock
let lastTime = 0

@@ -97,3 +99,3 @@ // Animation loop

// Compute elapsed time since last render frame
var deltaTime = lastTime ? (time - lastTime) / 1000 : 0
const deltaTime = (time - lastTime) / 1000

@@ -153,13 +155,15 @@ // Move bodies forward in time

1. Bump version number.
2. Build and commit files in `dist/` and `docs/`.
3. Tag the commit with the version number e.g. vX.Y.Z
4. Add release notes to github
5. Publish to NPM
1. Create changesets as you make changes with `yarn run change`
2. Bump version number with `yarn run bump`
3. Build and generate docs, commit files in `dist/` and `docs/`.
4. Tag the commit with the version number e.g. vX.Y.Z
5. Add release notes to github
6. Publish to NPM with `yarn run publish`
### TODO
- [ ] add hasActiveBodies to World and use in use-p2 (see [cannon-es](https://github.com/pmndrs/cannon-es/blob/master/src/world/World.ts#L868))
- [ ] Add hasActiveBodies to World and use in use-p2 (see [cannon-es](https://github.com/pmndrs/cannon-es/blob/master/src/world/World.ts#L868))
- [ ] Convert demo framework to typescript and include in lib
- [ ] Evaluate PRs in p2.js repo
- [ ] [Refactoring Springs](https://github.com/schteppe/p2.js/pull/148)
- [ ] [Adjustments to the buoyancy demo to make the code more easily reusable](https://github.com/schteppe/p2.js/pull/263)

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc