forked from lokesh-sharma/GameEngine
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPhysicsObject.h
More file actions
38 lines (34 loc) · 1010 Bytes
/
PhysicsObject.h
File metadata and controls
38 lines (34 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef PHYSICSOBJECT_H
#define PHYSICSOBJECT_H
#include<glm/glm.hpp>
#include"mesh.h"
#include"transform.h"
#include"btBulletDynamicsCommon.h"
#include"LinearMath/btTransform.h"
#include"LinearMath/btVector3.h"
class PhysicsObject
{
public:
enum
{
TYPE_BOUNDINGSPHERE,
TYPE_BOX,
TYPE_CYLINDER,
TYPE_CONE,
TYPE_SIZE
};
PhysicsObject(Mesh* mesh , glm::vec3 pos ,float mass , int isStaticObject);
PhysicsObject(glm::vec3 pos , glm::vec3 halfExtents , float mass , int shapeType);
void integrate();
btRigidBody* getRigidBody() { return m_body;}
Transform* getTransform() { return &m_transform ;}
void disableRotation() { m_disableRotation = true ;}
private:
Transform m_transform;
bool m_isActive;
bool m_disableRotation;
btRigidBody* m_body;
btRigidBody* triangleMeshFromMesh(Mesh* mesh , glm::vec3 pos);
btRigidBody* convexHullFromMesh(Mesh* mesh , glm::vec3 pos , float mass);
};
#endif // PHYSICSOBJECT_H