All Projects → fenomas → voxel-physics-engine

fenomas / voxel-physics-engine

Licence: MIT license
Simple but physical engine for voxels. Demo:

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to voxel-physics-engine

Voxel Core
Voxel plugin for the Godot game engine!
Stars: ✭ 148 (+150.85%)
Mutual labels:  voxel
Marching Cubes On The Gpu
A implementation of the marching cubes algorithm on the GPU in Unity.
Stars: ✭ 208 (+252.54%)
Mutual labels:  voxel
Intro-Voxel-Terrain-in-Unity
A course on making the easiest to understand voxel engine (in Unity) using the C#JobSystem.
Stars: ✭ 25 (-57.63%)
Mutual labels:  voxel
Expo Voxel
🎮🌳 Voxel Terrain made in React Native. ∛
Stars: ✭ 169 (+186.44%)
Mutual labels:  voxel
Voxel
Voxel design tool built on top of css transformations
Stars: ✭ 199 (+237.29%)
Mutual labels:  voxel
Cupoch
Robotics with GPU computing
Stars: ✭ 225 (+281.36%)
Mutual labels:  voxel
Mine.js
🌏 A Minecraft-like voxel engine built in Javascript. (formerly mc.js)
Stars: ✭ 136 (+130.51%)
Mutual labels:  voxel
Perlin-Noise-3D-Voxel-Generator
Voxel generator based on perlin 3d noise | Python OpenGL
Stars: ✭ 22 (-62.71%)
Mutual labels:  voxel
Pix2vox
Sketch-Based 3D Exploration with Stacked Generative Adversarial Networks
Stars: ✭ 206 (+249.15%)
Mutual labels:  voxel
Spatio temporal voxel layer
A new voxel layer leveraging modern 3D graphics tools to modernize navigation environmental representations
Stars: ✭ 246 (+316.95%)
Mutual labels:  voxel
Vision3d
Research platform for 3D object detection in PyTorch.
Stars: ✭ 177 (+200%)
Mutual labels:  voxel
Chunkstories
Somewhat fancy blocky game engine written in Kotlin
Stars: ✭ 199 (+237.29%)
Mutual labels:  voxel
Proceduralterrain
Procedural voxel terrain generation in Unity
Stars: ✭ 237 (+301.69%)
Mutual labels:  voxel
Voxlords
VoxLords - ThreeJS WebGL game with a simple voxel engine
Stars: ✭ 154 (+161.02%)
Mutual labels:  voxel
voxel-builder
Voxel-based 3D modeling application
Stars: ✭ 31 (-47.46%)
Mutual labels:  voxel
Building Blocks
A voxel library for real-time applications.
Stars: ✭ 140 (+137.29%)
Mutual labels:  voxel
Pix2vox
Implementation of "Pix2Vox: Context-aware 3D Reconstruction from Single and Multi-view Images" (Xie et al., ICCV 2019)
Stars: ✭ 216 (+266.1%)
Mutual labels:  voxel
ObjToSchematic
A tool to convert .obj files into Minecraft Schematics
Stars: ✭ 156 (+164.41%)
Mutual labels:  voxel
voxelmetaverse
playing with voxel.js
Stars: ✭ 75 (+27.12%)
Mutual labels:  voxel
Sucle
Common Lisp Voxel Game Engine
Stars: ✭ 239 (+305.08%)
Mutual labels:  voxel

voxel-physics-engine

Abstracted terrain physics for voxel game engines.

This implements reasonably realistic physics for voxel games. It was made to work with noa or voxel.js, but all it requires is abstracted (x,y,z) => boolean test functions for voxel properties, so it can be used with any engine.

This library replaces voxel-physical, though it works quite differently and behaves more physically. The engine can be seen in action in noa or projects using it.

Note: this simple engine only handles collisions between bodies and solid voxels. It does not handle collisions between rigid bodies, or non-cubic voxels.

Usage:

  1. Create engine and supply a (x,y,z) => boolean functions that return whether a given voxel is solid or liquid.
  2. Add rigid bodies with var body = addBody(..)
  3. Modify body properties, or call its methods to apply forces, impulses, etc.
  4. Call tick(dt) on the engine object

and the engine will update each body and handle voxel collisions.

Example

import { Physics } from 'voxel-physics-engine'
var opts = { gravity: [0, -10, 0] }
var voxelIsSolid = (x, y, z) => (y < 0)
var voxelIsLiquid = (x, y, z) => (x > 5)

var phys = new Physics(opts, voxelIsSolid, voxelIsLiquid)
var body = phys.addBody( aabb, mass, friction, restitution, gravityMult, onCollide )
phys.tick( dt_in_miliseconds )
phys.removeBody( body )

Features

  • Reasonably physical, supports standard properties (friction, restitution, etc.)
  • Query the body's resting[axis] property (-1,0,1 on each axis) to tell if it's currently touching a solid voxel. E.g. body.resting[1] is 1 when the body is colliding with the ceiling.
  • Collisions with terrain trigger each body's onCollide(impacts) callback. The argument is a vec3 of the collision impulse on each axis. (A body resting on the ground will produce a small impact each tick due to gravity.)
  • If you set a body's autoStep property, the engine will cause it to automatically "step" onto one-block obstructions.

Changes in latest version:

  • 0.13.0 - minor fixes to typing and internals
  • 0.11.0 - export a named constructor function instead of a callback
  • 0.10.0
    • Fixes body.onCollide arg to be a correctly scaled impulse vector
    • Body onCollide now passed before bounces are resolved (allowing client to adjust body.restitution depending on the terrain)
  • 0.9.0
    • Air and fluid friction properties renamed to airDrag and fluidDrag, and now work equivalently (no drag at 0, large drag at 1)
    • Per body airDrag and fluidDrag override global settings if >= 0
  • 0.8.0
    • Friction now uses regular coefficients, and works in all directions, not just downwards
    • Bodies have an .airFriction that overrides the global value (if nonzero)
    • Air and regular friction should now scale correctly with frame rate
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].