Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
prism/engine/core/include/physics.hpp

40 lines
970 B
C++
Raw Normal View History

2020-08-11 12:07:21 -04:00
#pragma once
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Weverything"
#if defined(PLATFORM_MACOS) || defined(PLATFORM_IOS) || defined(PLATFORM_TVOS)
#include <btBulletDynamicsCommon.h>
#else
#include <bullet/btBulletDynamicsCommon.h>
#endif
#include <memory>
#pragma clang diagnostic pop
#include "vector.hpp"
#include "object.hpp"
class Physics {
public:
Physics();
void update(float deltaTime);
void reset();
void remove_object(Object obj);
struct RayResult {
bool hasHit;
Vector3 location;
};
RayResult raycast(Vector3 from, Vector3 to);
private:
std::unique_ptr<btBroadphaseInterface> broadphase;
std::unique_ptr<btDefaultCollisionConfiguration> collisionConfiguration;
std::unique_ptr<btCollisionDispatcher> dispatcher;
std::unique_ptr<btSequentialImpulseConstraintSolver> solver;
std::unique_ptr<btDiscreteDynamicsWorld> world;
};