[PlayerBox] Now handling player rotation.
This commit is contained in:
parent
9f01a538cb
commit
589118e6e9
@ -92,7 +92,7 @@ This list is non exhaustive.
|
||||
- Custom GUI creation
|
||||
- Special blocks (workbench, furnace)
|
||||
- Block metadata
|
||||
- Player model display (currently without rotation nor animation)
|
||||
- Player model display (without animation)
|
||||
- Dimensions (like the Nether or the Ender in Minecraft) ([#80](https://github.com/Unarelith/OpenMiner/pull/80))
|
||||
- World loading/saving (using `/save <name>` and `/load <name>` commands, see [#26](https://github.com/Unarelith/OpenMiner/issues/26))
|
||||
- Texture pack system (partially implemented, see [#34](https://github.com/Unarelith/OpenMiner/issues/34))
|
||||
|
@ -274,6 +274,7 @@ void PlayerBox::draw(gk::RenderTarget &target, gk::RenderStates states) const {
|
||||
// Subtract the camera position - see comment in ClientWorld::draw()
|
||||
gk::Vector3d cameraPosition = m_camera.getDPosition();
|
||||
states.transform.translate(m_x - cameraPosition.x, m_y - cameraPosition.y, m_z - cameraPosition.z);
|
||||
states.transform.rotate(m_viewAngleH, gk::Vector3{0, 0, 1});
|
||||
|
||||
states.transform *= getTransform();
|
||||
states.texture = &m_texture;
|
||||
|
@ -227,6 +227,19 @@ void ClientCommandHandler::setupCallbacks() {
|
||||
}
|
||||
});
|
||||
|
||||
m_client.setCommandCallback(Network::Command::PlayerRotUpdate, [this](Network::Packet &packet) {
|
||||
float yaw, pitch;
|
||||
u16 clientId;
|
||||
packet >> clientId;
|
||||
packet >> yaw >> pitch;
|
||||
|
||||
if (clientId != m_client.id()) {
|
||||
auto it = m_playerBoxes.find(clientId);
|
||||
if (it != m_playerBoxes.end())
|
||||
it->second.Player::setRotation(yaw, pitch);
|
||||
}
|
||||
});
|
||||
|
||||
m_client.setCommandCallback(Network::Command::PlayerSpawn, [this](Network::Packet &packet) {
|
||||
u16 clientId;
|
||||
gk::Vector3d pos;
|
||||
|
Loading…
x
Reference in New Issue
Block a user