|
Revision 542, 0.7 kB
(checked in by gaul@…, 6 months ago)
|
- move code from .h into .cc files
- prepare ODEObj for enable()/disable() in order to retrieve corresponding ODEObjs in collision detection
|
| Line | |
|---|
| 1 | #include "ode_sphere.h" |
|---|
| 2 | |
|---|
| 3 | using namespace mmp; |
|---|
| 4 | |
|---|
| 5 | ODESphere::ODESphere(NetGame::pointer _game, uint16_t entid, bool _movable) : |
|---|
| 6 | ODEObj<NetEnt::ODESphere, dSphere>(_game, entid) |
|---|
| 7 | { |
|---|
| 8 | geom.create(get_space(), 1.0); |
|---|
| 9 | |
|---|
| 10 | classname="ODESphere"; |
|---|
| 11 | if (_movable) |
|---|
| 12 | set_movable(); |
|---|
| 13 | } |
|---|
| 14 | |
|---|
| 15 | |
|---|
| 16 | void ODESphere::update(NetMsg::pointer msg) { |
|---|
| 17 | ODEObj<NetEnt::ODESphere, dSphere>::update(msg); |
|---|
| 18 | if (msg->get_state()==NetMsg::StatPacking) { |
|---|
| 19 | msg->pack_ode(geom.getRadius()); |
|---|
| 20 | } else if (msg->get_state()==NetMsg::StatUnpacking) { |
|---|
| 21 | dReal r; |
|---|
| 22 | msg->unpack_ode(r); |
|---|
| 23 | geom.setRadius(r); |
|---|
| 24 | } else |
|---|
| 25 | throw std::runtime_error("NetMsg not in packing or unpacking state"); |
|---|
| 26 | } |
|---|