use of org.terasology.logic.location.LocationResynchEvent in project Terasology by MovingBlocks.
the class PhysicsSystem method sendSyncMessages.
private void sendSyncMessages() {
Iterator<EntityRef> iter = physics.physicsEntitiesIterator();
while (iter.hasNext()) {
EntityRef entity = iter.next();
if (entity.hasComponent(NetworkComponent.class)) {
// TODO after implementing rigidbody interface
RigidBody body = physics.getRigidBody(entity);
if (body.isActive()) {
entity.send(new LocationResynchEvent(body.getLocation(new Vector3f()), body.getOrientation(new Quat4f())));
entity.send(new PhysicsResynchEvent(body.getLinearVelocity(new Vector3f()), body.getAngularVelocity(new Vector3f())));
}
}
}
}
Aggregations