A 2D physics engine
#include<iostream>
#include<Delta/delta.hpp>intmain(){
dt::World world;
// Create a dynamic body
dt::Body *ball = newdt::Body(dt::Vector(0.f, 0.f), newdt::Circle(0.5f));
// Create a static body
dt::Body *floor = newdt::Body(dt::Vector(0.f, 1.f), newdt::Rectangle(dt::Vector(3.f, 0.2f)), false, true);
// Add the bodies to the world
world.bodies.push_back(ball);
world.bodies.push_back(floor);
// Check for collisionwhile(!dt::Collision(ball, floor).Detect()){
// Print the position
std::cout << "Ball position: " << ball->position << std::endl;
// Step 1/60 second into the future
world.step(); }
std::cout << "Collision !" << std::endl;
delete ball;
delete floor;
return0;
}