Giter Club home page Giter Club logo

hecs_rapier's Introduction

physics engine for hecs

Port of bevy_rapier2d to hecs ECS.

WARNING

Example

use hecs_rapier as physics;
use hecs::World;

let mut world = World::new();

/* Create structures necessary for the simulation. */
let gravity = vector![0.0, -9.81];
let integration_parameters = physics::IntegrationParameters::default();
let mut physics_pipeline = physics::PhysicsPipeline::new();
let mut island_manager = physics::IslandManager::new();
let mut broad_phase = physics::BroadPhase::new();
let mut narrow_phase = physics::NarrowPhase::new();
let mut joint_set = physics::JointSet::new();
let mut joints_entity_map = physics::JointsEntityMap::default();
let mut ccd_solver = physics::CCDSolver::new();
// let physics_hooks = ();
let event_handler = ();
let mut modification_tracker = physics::ModificationTracker::default();

while running {
        physics::attach_bodies_and_colliders(&mut world);
        physics::create_joints(&mut self.world, &mut joint_set, &mut joints_entity_map);
        physics::finalize_collider_attach_to_bodies(&mut world, &mut modification_tracker);


        physics::prepare_step(&mut world, &mut modification_tracker);

        while need_to_step {

            physics::step_world(
                &mut world,
                &gravity,
                &integration_parameters,
                &mut physics_pipeline,
                &mut modification_tracker,
                &mut island_manager,
                &mut broad_phase,
                &mut narrow_phase,
                &mut joint_set,
                &mut joints_entity_map,
                &mut ccd_solver,
                &event_handler,
            );

        }


        physics::collect_removals(&mut world, &mut modification_tracker);

        next_frame().await;
        world.clear_trackers();
}

hecs_rapier's People

Contributors

smokku avatar

Stargazers

 avatar

Watchers

 avatar  avatar

hecs_rapier's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.