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
|
#ifndef DYNAMICAPSULEOBJECT_H
#define DYNAMICAPSULEOBJECT_H
#include <string>
#include <ode/ode.h>
#include <plib/ssg.h>
#include "dynamicobject.h"
class DynamicCapsuleObject : public DynamicObject
{
public:
DynamicCapsuleObject(ssgEntity *model, dWorldID world, dSpaceID bigspace, const dReal *pos, float radius, float length) :
DynamicObject(model, world, bigspace)
{
body = dBodyCreate (world);
dMass m;
dMassSetCapsule(&m, 1000, 1, radius, length);
dBodySetMass (body,&m);
geom = dCreateCapsule(bigspace, radius, length);
dGeomSetBody (geom,body);
dGeomSetData (geom,this);
dQuaternion q;
dQFromAxisAndAngle(q,0,1,0,M_PI*0.5);
dGeomSetOffsetQuaternion(geom, q);
dBodySetPosition (body,pos[0],pos[1],pos[2]);
name="unnamed capsule object";
}
virtual ~DynamicCapsuleObject()
{
}
};
#endif
|