Natively multithreaded physics for threejs with PhysX.

Overview

Three-Physx

Natively multithreaded physics for threejs with PhysX and an easy interface.

Credit to Milkshake inc, physx-js, three-ammo, three-to-cannon, engine-3-zjt

DISCLAIMER: this is a work in progress and API & implementation is set to change

Progress:

  • Load WASM in webworker
  • Set up message queue & function calls over events
  • three-to-physx shape converter
  • return transforms
  • kinematic
  • collision events
  • update bodies
  • new build with more bindings
  • put body ids on arraybuffers for more efficient data transfer
  • capsule
  • character controller
  • collision filtering
  • trimesh and convex
  • raycasts
  • get rid of transform, make internal and rely entirely on Vector3 & Quaternion
  • fix up updating body and shape data
  • obstacles
  • fix root object scaling bug
  • raycasts ignore backface option
  • vehicle controller
  • heightfield colliders
  • geometry per instance scaling
  • add subscribe for event listeners on worker to reduce redundant transfer overhead
  • advanced & customisable collision filtering
  • full api support (eventually)
  • move most stuff to WASM for improved performance

Example

https://three-physx.netlify.app/

Netlify Status

API

-work in progress-

This multithreaded PhysX API uses a singleton approach. This way the PhysX interface is accessible globally once instantiated.

import { PhysXInstance, Transform } from 'three-physx';

// create the interface
await PhysXInstance.instance.initPhysX(new Worker('./worker.js'), { tps: 60, start: true });

// add an object
const body = PhysXInstance.instance.addBody(new Body({
  shapes: [
    {
      shape: SHAPES.Box,
      config: {
        collisionLayer: COLLISIONS.FLOOR,
        collisionMask: COLLISIONS.ALL
      }
    }
  ],
  type: BodyType.DYNAMIC
}));

// In scene loop
PhysXInstance.instance.update();

worker.js

import { receiveWorker } from "three-physx";
import PHYSX from './physx.release.js';
PHYSX().then(receiveWorker);

Building PhysX

cd physx-js
npm install
npm run generate
npm run dev

This will copy files to /lib

Owner
XR Foundation
A metaverse for everyone.
XR Foundation
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK This is the official C++ source code repository of the Bullet Physics SDK: real-time collision detection and multi-physics simulati

Bullet Physics SDK 9.3k May 10, 2022
Box2D is a 2D physics engine for games

Build Status Box2D Box2D is a 2D physics engine for games. Contributing Please do not submit pull requests with new features or core library changes.

Erin Catto 5.7k May 17, 2022
A fast and lightweight 2D game physics library.

NEW IN CHIPMUNK 7 Chipmunk 7 is complete and now includes the ARM NEON optimizations, the autogeometry code, and the mulithreaded solver. The latest p

Scott Lembcke 1.8k May 11, 2022
2D physics engine for games

LiquidFun Version 1.1.0 Welcome to LiquidFun! LiquidFun is a 2D physics engine for games. Go to our landing page to browse our documentation and see s

Google 4.4k May 7, 2022
C++ library for multi-physics simulation

Project CHRONO Project Chrono represents a community effort aimed at producing a physics-based modelling and simulation infrastructure based on a plat

null 1.4k May 13, 2022
High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.

Simbody Simbody is a high-performance, open-source toolkit for science- and engineering-quality simulation of articulated mechanisms, including biomec

Simbody Project 1.9k May 15, 2022
Real-time multi-physics simulation with an emphasis on medical simulation.

Introduction SOFA is an open source framework primarily targeted at real-time simulation, with an emphasis on medical simulation. It is mainly intende

SOFA Framework 605 May 10, 2022
cake is a programming language designed to be conventional as well as incredibly fast, natively available on these platforms.

cake The fast crossplatform programming language What's cake? cake is a programming language designed to be conventional as well as incredibly fast, n

Shadoww 4 Mar 6, 2022
NVIDIA PhysX SDK 3.4

NVIDIA PhysX SDK 3.4 Copyright (c) 2018 NVIDIA Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without mo

NVIDIA GameWorks 2.3k May 17, 2022
Physx wrapper for the Beef Programming Language

physx-beef Physx wrapper for the Beef Programming Language physx-rs Prerequisites To initialize submodules run git submodule update --init --recursive

Aleš Mlakar 1 Nov 15, 2021
NVIDIA PhysX SDK

NVIDIA PhysX SDK 4.1 Copyright (c) 2021 NVIDIA Corporation. All rights reserved. Redistribution and use in source and binary forms, with or without mo

NVIDIA GameWorks 2.4k May 7, 2022
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK This is the official C++ source code repository of the Bullet Physics SDK: real-time collision detection and multi-physics simulati

Bullet Physics SDK 9.3k May 10, 2022
Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Bullet Physics SDK 9.3k May 11, 2022
A easy to use multithreading thread pool library for C. It is a handy stream like job scheduler with an automatic garbage collector. This is a multithreaded job scheduler for non I/O bound computation.

A easy to use multithreading thread pool library for C. It is a handy stream-like job scheduler with an automatic garbage collector for non I/O bound computation.

Hyoung Min Suh 11 Mar 6, 2021
This is a single-header, multithreaded C++ library for simulating the effect of hydraulic erosion on height maps.

TinyErode This is a single-header, multithreaded C++ library for simulating the effect of hydraulic erosion on height maps. The algorithm is based on

Taylor 39 Apr 1, 2022
Performance Evaluation of a Parallel Image Enhancement Technique for Dark Images on Multithreaded CPU and GPU Architectures

Performance Evaluation of a Parallel Image Enhancement Technique for Dark Images on Multithreaded CPU and GPU Architectures Image processing is a rese

Batuhan Hangün 5 Nov 4, 2021
Header-only library for multithreaded programming

CsLibGuarded Introduction The CsLibGuarded library is a standalone header only library for multithreaded programming. This library provides templated

CopperSpice 177 Apr 12, 2022
Ole Christian Eidheim 731 May 3, 2022
Multithreaded client socket server

-------------------------------------------------------------------------------------- File structure ------------------------------------------------

Ashish Kaushik 1 Mar 1, 2022
Header-only library for multithreaded programming

CsLibGuarded Introduction The CsLibGuarded library is a standalone header only library for multithreaded programming. This library provides templated

CopperSpice 177 Apr 12, 2022
A way to visualize your multithreaded Mbed OS application like never before!

MbedSysview Library A way to visualize your multithreaded Mbed OS application like never before! MbedSysview is a library that connects the Mbed OS ta

Jamie Smith 3 Dec 27, 2021
EAThread - EAThread implements a unified cross-platform interface for multithreaded programming.

EAThread EAThread implements a unified cross-platform interface for multithreaded programming on various platforms. Documentation Please see Introduct

Electronic Arts 240 May 8, 2022
A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio.

A very simple, fast, multithreaded, platform independent HTTP and HTTPS server and client library implemented using C++11 and Boost.Asio. Created to be an easy way to make REST resources available from C++ applications.

Ole Christian Eidheim 2.3k May 7, 2022
[WIP] Experimental C++14 multithreaded compile-time entity-component-system library.

ecst Experimental & work-in-progress C++14 multithreaded compile-time Entity-Component-System header-only library. Overview Successful development of

Vittorio Romeo 441 May 9, 2022
Box2D is a 2D physics engine for games

Build Status Box2D Box2D is a 2D physics engine for games. Contributing Please do not submit pull requests with new features or core library changes.

Erin Catto 5.7k May 17, 2022
A fast and lightweight 2D game physics library.

NEW IN CHIPMUNK 7 Chipmunk 7 is complete and now includes the ARM NEON optimizations, the autogeometry code, and the mulithreaded solver. The latest p

Scott Lembcke 1.8k May 11, 2022
2D physics engine for games

LiquidFun Version 1.1.0 Welcome to LiquidFun! LiquidFun is a 2D physics engine for games. Go to our landing page to browse our documentation and see s

Google 4.4k May 7, 2022
C++ library for multi-physics simulation

Project CHRONO Project Chrono represents a community effort aimed at producing a physics-based modelling and simulation infrastructure based on a plat

null 1.4k May 13, 2022
High-performance C++ multibody dynamics/physics library for simulating articulated biomechanical and mechanical systems like vehicles, robots, and the human skeleton.

Simbody Simbody is a high-performance, open-source toolkit for science- and engineering-quality simulation of articulated mechanisms, including biomec

Simbody Project 1.9k May 15, 2022