• Stars
    star
    611
  • Rank 70,821 (Top 2 %)
  • Language
    Rust
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐ŸŽณ Rust binding for NVIDIA PhysX ๐Ÿฆ€

๐ŸŽณ physx-rs

Rust binding for NVIDIA PhysX, a popular and mature physics engine well-suited for games

Embark Embark Crates.io Docs dependency status Build status

Created and maintained by Embark and not officially supported by NVIDIA.

This repository contains 2 crates:

Name Description Links
physx High-level interface on top of physx-sys ๐Ÿšง Crates.io Docs
physx-sys Unsafe bindings to the PhysX C++ API Crates.io Docs

Why use it?

  • You want a feature-rich and performant physics engine to use in your project.

Caveats

  • The high-level physx wrapper is work-in-progress, and only covers a part of PhysX functionality. You can follow our progress and see where contributions are needed in our Tracking Issue for High-Level API Completeness.

  • Any other features have to be accessed through the unsafe physx-sys crate.

  • It's a large C++ codebase which requires a C++ toolchain, and comes with a non-trivial build system.

Alternatives

  • Rapier: a 2D and 3D physics engine for games, animation, and robotics written in Rust. Fully cross-platform, with web support and optional cross-platform determinism on IEEE 754-2008 compliant systems.

  • nphysics: a 2- and 3-dimensional physics engine for games and animations written in Rust. It is a good option for projects which do not require the full feature set of PhysX or prefer a native Rust solution.

Presentation

Tomasz Stachowiak did a presentation at the Stockholm Rust Meetup on October 2019 about this project that goes through the technical details of how C++ to Rust bindings of physx-sys works:

An unholy fusion of Rust and C++ in physx-rs (Stockholm Rust Meetup, October 2019)

Usage

The following code example shows how physx can be initialized.

const PX_PHYSICS_VERSION: u32 = physx::version(4, 1, 1);
let mut foundation = Foundation::new(PX_PHYSICS_VERSION);

let mut physics = PhysicsFoundation::default();

let mut scene = physics.create(
    SceneDescriptor {
        gravity: PxVec3::new(0.0, 0.0, -9.81),
        ..SceneDescriptor::new(MySceneUserData::default())
    }
);

You can run an example with cargo run --example ball, which should show the following output:

Example

Information about all wrapper functionality can be found in the physx crate docs.

If you require functionality not covered by the physx wrapper you can use the low level physx-sys crate, which closely maps to the official PhysX SDK. You can find the PhysX user guide here.

Prerequisites

How to build

git submodule update --init
cargo build --release

Windows Note

It is highly recommended to not enable debug info in release mode when building with MSVC, as the Physx C++ code will take an extremely long time to compile. You can disable this by putting the following in your Cargo.toml

[profile.release.package.physx-sys]
debug = false

How to release (maintainers only)

  1. Install cargo-release
  2. Look at physx/CHANGELOG.md and physx-sys/CHANGELOG.md to determine whether both or only one of the crate needs updating, and what semantic version bump we need
  3. Review the list of changes in the changelogs and compare with the git commit diffs to the previous release and make sure we've captured and described all changes well and that they are semantically correct
  4. Run cargo release --manifest-path <physx|physx-sys>/Cargo.toml <major|minor|patch> to automatically update the CHANGELOG, publish, tag, and push the release. If you are publishing both physx and physx-sys, you can just add the --skip-push flag to avoid pushing each crate individually and then do git push --follow-tags to push both at the same time.

Contributing

Contributor Covenant

We welcome community contributions to this project.

Please read our Contributor Guide for more information on how to get started.

License

Licensed under either of

at your option.

Note that the PhysX C++ SDK has its own BSD 3 license and depends on additional C++ third party libraries.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

More Repositories

1

rust-gpu

๐Ÿ‰ Making Rust a first-class language and ecosystem for GPU shaders ๐Ÿšง
Rust
6,796
star
2

kajiya

๐Ÿ’ก Experimental real-time global illumination renderer ๐Ÿฆ€
Rust
4,524
star
3

texture-synthesis

๐ŸŽจ Example-based texture synthesis written in Rust ๐Ÿฆ€
Rust
1,717
star
4

wg-ui

WireGuard Web UI for self-serve client configurations, with optional auth.
Go
1,468
star
5

cargo-deny

โŒ Cargo plugin for linting your dependencies ๐Ÿฆ€
Rust
1,254
star
6

puffin

๐Ÿฆ Friendly little instrumentation profiler for Rust ๐Ÿฆ€
Rust
973
star
7

rust-ecosystem

Rust wants & tracking for Embark ๐Ÿฆ€
Rust
843
star
8

blender-tools

๐Ÿต Embark Addon for Blender
Python
392
star
9

cargo-about

๐Ÿ“œ Cargo plugin to generate list of all licenses for a crate ๐Ÿฆ€
Rust
320
star
10

tryhard

๐Ÿ’ซ Easily retry futures ๐Ÿฆ€
Rust
182
star
11

presser

A crate to help you copy things into raw buffers without invoking spooky action at a distance (undefined behavior).
Rust
150
star
12

rpmalloc-rs

๐Ÿ rpmalloc global memory allocator for Rust ๐Ÿฆ€
Rust
126
star
13

crash-handling

Collection of crates to deal with crashes
Rust
122
star
14

poll-promise

A Rust promise for games and immediate mode GUIs
Rust
119
star
15

discord-sdk

An open implementation of the Discord Game SDK in Rust
Rust
108
star
16

skyhook

Simple Python communication system for DCC's and Game Engines
Python
104
star
17

spirt

SPIR-๐Ÿ‡น: shader-focused IR to target, transform and translate from ๐Ÿฆ€
Rust
101
star
18

superluminal-perf-rs

๐Ÿ”† Superluminal Performance profiler Rust API ๐Ÿฆ€
Rust
94
star
19

ash-molten

๐ŸŒ‹ Statically linked MoltenVK for Vulkan on Mac using Ash ๐Ÿฆ€
Rust
91
star
20

cargo-deny-action

โŒ GitHub Action for cargo-deny ๐Ÿฆ€
Shell
89
star
21

cargo-fetcher

๐ŸŽ cargo plugin for quickly fetching dependencies ๐Ÿฆ€
Rust
83
star
22

relnotes

Automatic GitHub Release Notes
Rust
77
star
23

opensource-template

๐ŸŒป Template for creating new repositories
74
star
24

tame-oauth

๐Ÿ” Small OAuth crate that follows the sans-io approach ๐Ÿฆ€
Rust
68
star
25

mirror-mirror

๐Ÿชž Powerful reflection library for Rust
Rust
68
star
26

tiny-bench

A tiny benchmarking library
Rust
55
star
27

k8s-buildkite-plugin

Run any buildkite build step as a Kubernetes Job
Jsonnet
48
star
28

krates

๐Ÿ“ฆ Creates graphs of crates from cargo metadata ๐Ÿฆ€
Rust
45
star
29

opensource

Open source processes, policies, and info
Rust
42
star
30

tame-gcs

๐Ÿ“‚ A small library with a limited set of Google Cloud Storage operations ๐Ÿฆ€
Rust
37
star
31

cervo

Utility wrappers for tract
Rust
36
star
32

server-framework

Framework for running network services, opinions included
Rust
36
star
33

tracing-logfmt

A logfmt formatter for tracing subscriber logs
Rust
35
star
34

octobors

Rust program for automerging PRs based on a few rules
Rust
35
star
35

nfd2

OS native dialogs for Windows, MacOS, and Linux
Rust
32
star
36

cfg-expr

A parser and evaluator for Rust cfg() expressions. Targets as of Rust 1.58.0 are supported.
Rust
32
star
37

opa-policies

Contains OPA Policies for Dockerfiles, Kubernetes YAMLs, Terraform, etc
Open Policy Agent
29
star
38

gsutil

Minimal gsutil replacement
Rust
27
star
39

spdx

๐Ÿ†” Helper crate for SPDX expressions. ๐Ÿฆ€
Rust
27
star
40

pdm-plugin-torch

A tool for managing torch-variants with PDM.
Python
22
star
41

opensource-website

๐ŸŒ Hub for Embark's open source efforts
HTML
22
star
42

buildkite-jobify

๐Ÿ‘ท Kubekite, but in Rust, using configuration from your repos ๐Ÿฆ€
Rust
21
star
43

spirv-tools-rs

๐Ÿ›  Wrapper crate for SPIRV-Tools ๐Ÿฆ€
C++
20
star
44

tame-index

Small crate for interacting with cargo registry indices
Rust
18
star
45

emote

Reinforcement learning library from Embark Studios
Python
17
star
46

rymder

Unofficial agones client SDK
Rust
17
star
47

fsr-rs

Rust bindings for AMD FidelityFXโ„ข Super Resolution
C
16
star
48

proto-gen

A protobuf generation runner/cli using tonic build
Rust
15
star
49

sentry-contrib-rust

Integrates crashdump reporting with Sentry
Rust
15
star
50

tame-oidc

๐Ÿงฌ Small OAuth crate that follows the sans-io approach ๐Ÿฆ€
Rust
11
star
51

cloud-dns

A wrapper for the Google Cloud DNS API (https://cloud.google.com/dns)
Rust
10
star
52

tame-webpurify

๐Ÿ’ฉ Small HTTP client for the Webpurify API following the sans-io approach ๐Ÿฆ€
Rust
9
star
53

tracing-ext-ffi-subscriber

Simple subscriber for forwarding tracing spans to a C or C++ profiling API.
Rust
4
star
54

server-code-exciser

A program that contains grammars and functionality to remove server only code from code bases.
C#
4
star
55

boh

Rust
4
star
56

gke-accelerated-xorg-example

Example project for running remote rendering on GKE
Dockerfile
3
star
57

helix-oidc

๐Ÿงฌ Helix Perforce OIDC validator
Go
3
star
58

cassini

Topology-aware distributed cache
Go
2
star
59

minwin

Rust
2
star
60

container-packer-qemu

๐Ÿ“ฆ Dockerized packer with qemu
Dockerfile
1
star
61

rustc-compile-time-regress

Rust
1
star
62

.github

Default community health files for GitHub (https://help.github.com/en/github/building-a-strong-community/creating-a-default-community-health-file-for-your-organization)
1
star
63

missing-symbols

Rust
1
star