Added getRotation in physics to give rotation of object back as 4x4Matrix
This commit is contained in:
parent
0d9300193c
commit
d5198ff4f5
10
physics.cc
10
physics.cc
@ -100,9 +100,15 @@ glm::vec3 getPos(int i)
|
||||
return save;
|
||||
}
|
||||
|
||||
void getRotation(int i)
|
||||
glm::mat4 getRotation(int i)
|
||||
{
|
||||
btQuaternion rotQuantrino = bodies[i]->getOrientation(); //TODO return orientation in gl format
|
||||
btQuaternion quat = bodies[i]->getOrientation();
|
||||
|
||||
glm::mat4 matrix = glm::rotate(
|
||||
matrix,
|
||||
quat.getAngle(),
|
||||
glm::vec3(quat.getAxis().getX(), quat.getAxis().getY(), quat.getAxis().getZ())
|
||||
);
|
||||
}
|
||||
|
||||
void rollForward()
|
||||
|
@ -26,6 +26,8 @@
|
||||
#include "extern/bullet/src/LinearMath/btMotionState.h"
|
||||
#include "extern/bullet/src/LinearMath/btDefaultMotionState.h"
|
||||
#include "extern/bullet/src/LinearMath/btQuaternion.h"
|
||||
#include "extern/bullet/src/LinearMath/btVector3.h"
|
||||
#include "extern/bullet/src/LinearMath/btMatrix3x3.h"
|
||||
|
||||
class Physics {
|
||||
public:
|
||||
@ -35,7 +37,7 @@ class Physics {
|
||||
void takeUpdateStep(float timeDiff);
|
||||
void rollForward(glm::vec3 camPos, float strength);
|
||||
glm::vec3 getPos(int i);
|
||||
void getRotation(int i);
|
||||
glm::mat4 getRotation(int i);
|
||||
void rollForward();
|
||||
void addTerrain(int width, int length, float** heightData);
|
||||
void addSphere(float rad, float x, float y, float z, float mass, int indice);
|
||||
|
Loading…
Reference in New Issue
Block a user