npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

physx-js

v0.7.0

Published

PhysX for JavaScript.

Downloads

18

Readme

PhysX JS

PhysX for JavaScript.

This repo complements the work being done over at prestomation/PhysX to create emscripten bindings for NVIDIAGameWorks/PhysX. At some point the prestomation/PhysX fork may be merged into NVIDIAGameWorks/PhysX and this repo will be updated to track that repo instead.

This repo serves multiple purposes:

  • Provide a Docker workflow for compiling and building PhysX to WebAssembly via Emscripten
  • Provide a Docker workflow for adding new bindings (the whole PhysX API is not currently covered yet)
  • To publish WebAssembly files to npm (physx-js) so that they can be used in projects via npm or CDN

Example

There is an example with threejs and physx-js using Webpack in the /example folder. The example is also available to preview here, it's hosted on now

Usage via npm

npm install physx-js

The physx.release.js file can be imported via Webpack or included as a script on the page

The physx.release.wasm file needs to be served in a static/public folder so that it can be loaded in a browser environment

See /examples for how this can be used in Node, Browser and Browser w/ Webpack.

Usage via CDN (jsDelivr)

You may want to load the WebAssembly files via CDN, in which case you can use jsDelivr's npm mirror, loaded as a script:

<script src="https://cdn.jsdelivr.net/npm/physx-js/dist/physx.release.js">

You can also target a specific version:

<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/physx.release.js">

Then configure this to also load the wasm file from the same place:

PHYSX({
  locateFile(path) {
    if (path.endsWith('.wasm')) {
      return 'https://cdn.jsdelivr.net/npm/[email protected]/dist/physx.release.wasm'
    }
    return path
  }
})

Development

You may want to make your own builds from source, or modify the bindings yourself. The full PhysX API isn't covered yet but more will be added in the future.

The only dependencies you need to do this are Docker, Node and Npm. All other dependencies are managed inside the docker image.

The scripts run from this repo expect the repo prestomation/PhysX#emscripten_wip to be mounted here at ./PhysX.

// Install dependencies
npm install

// Generate the project (i believe this only needs to be run once, can take a while)
npm run generate

// Build WebAssembly files (physx.release.js and physx.release.wasm)
// This is all that needs to be run after making changes to bindings.
npm run make

These scripts will start a docker container, mount the PhysX source code and then build and compile it using emscripten.

The output files (js and wasm) are copied into ./dist

If you want to add new bindings, edit ./PhysX/physx/source/physxwebbindings/src/PxWebBindings.cpp and then run npm run make to rebuild.