-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSPositionComponent.h
53 lines (43 loc) · 1.01 KB
/
SPositionComponent.h
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef SPOSITIONCOMPONENT_H_INCLUDED
#define SPOSITIONCOMPONENT_H_INCLUDED
#include <lf/Lightfeather.h>
#include <btBulletDynamicsCommon.h>
#include <entityx.h>
using namespace entityx;
using namespace lf;
struct PositionComponent : Component<PositionComponent>
{
float x,y,z;
PositionComponent(float x = 0.0f, float y = 0.0f, float z = 0.0f) : x(x), y(y), z(z)
{
}
PositionComponent(btVector3 btpos)
{
setPosition(btpos);
}
PositionComponent(core::vector3df lfpos)
{
setPosition(lfpos);
}
void setPosition(core::vector3df const &lfvector)
{
x = lfvector.X;
y = lfvector.Y;
z = lfvector.Z;
}
void setPosition(btVector3 const &btvector )
{
x = btvector.x();
y = btvector.y();
z = btvector.z();
}
core::vector3df getPositionLF()
{
return core::vector3df(x,y,z);
}
btVector3 getPositionBT()
{
return btVector3(x,y,z);
}
};
#endif // SPOSITIONCOMPONENT_H_INCLUDED