Skip to content

Knightro63/oimo_physics

Repository files navigation

oimo_physics

Pub Version analysis License: BSD

A 3D physics engine for dart (based on oimo.js) that allows users to add physics support to their 3D projects.

Image of blocks falling onto a surface.

This is a dart conversion of oimo.js, originally created by Saharan @saharan.

Usage

This project is a basic 3D physics engine for dart projects. This package includes RigidBodies, and Joints.

Getting started

To get started add oimo_physics, and your favorite 3D rendering engine to your pubspec.yaml file.

The Oimo World is the main scene that has all of the objects that will be manipulated to the scene. To get started add the oimo world then all of the objects in it.

If there is no shapes or type in the ObjectConfigure class it will not work. If you need a RigidBody use shapes. If you need a Joint use type.

  world = OIMO.World(OIMO.WorldConfigure(isStat:true, scale:100.0));

  OIMO.ShapeConfig config = OIMO.ShapeConfig(
    friction: 0.4,
    belongsTo: 1,
  );

  world!.add(OIMO.ObjectConfigure(
    shapes: [OIMO.Shapes.box],
    size:[400, 40, 400], 
    position:[0,-20,0], 
    shapeConfig:config
  ));
  
  bodys.add(world!.add(OIMO.ObjectConfigure(
    shapes:[OIMO.Shapes.sphere], 
    size:[w*0.5,w*0.5,w*0.5], 
    position:[x,y,z], 
    move:true, 
    shapeConfig:config,
    name: 'sphere'
  )) as OIMO.RigidBody);

Example

Find the example app here and the current web version of the code here.

Contributing

Contributions are welcome. In case of any problems look at existing issues, if you cannot find anything related to your problem then open an issue. Create an issue before opening a pull request for non trivial fixes. In case of trivial fixes open a pull request directly.

Additional Information

This plugin is only for performing basic physics. While this can be used as a standalone project it does not render scenes.