fix update interpolation

This commit is contained in:
gmueller 2011-01-25 22:46:36 +01:00
parent b9b83caa1a
commit e041357a06

View File

@ -299,7 +299,11 @@ void Network::dispatch(enet_uint8 *data, size_t length) {
btVector3 p1(m.x, m.y, m.z); btVector3 p1(m.x, m.y, m.z);
player->body->activate(true); player->body->activate(true);
player->body->setLinearVelocity(v1); player->body->setLinearVelocity(v1);
player->body->getWorldTransform().setOrigin((2 * p + p1) / 3); btVector3 dp = p1 - p;
if (dp.length2() > 5.)
player->body->getWorldTransform().setOrigin(p1);
else
player->body->getWorldTransform().setOrigin(p + dp/10.);
//player->body->applyCentralForce((v1 -v)/10.0); //player->body->applyCentralForce((v1 -v)/10.0);
#endif #endif
#if 0 #if 0
@ -514,6 +518,7 @@ void Network::send(const YAML::Emitter &em) {
void Network::sendMessage(uint8_t *data, size_t length) { void Network::sendMessage(uint8_t *data, size_t length) {
if (client_peer) { if (client_peer) {
std::cout << data << std::endl;
ENetPacket * packet = enet_packet_create(data, length, ENetPacket * packet = enet_packet_create(data, length,
ENET_PACKET_FLAG_RELIABLE); ENET_PACKET_FLAG_RELIABLE);
enet_peer_send(client_peer, 0, packet); enet_peer_send(client_peer, 0, packet);