generated from Persson-dev/Godot-Xmake
network: send player velocity
This commit is contained in:
@@ -69,7 +69,7 @@ void World::HandlePacket(const protocol::packets::PlayerPositionAndRotation& a_P
|
||||
if (data.m_Player == get_multiplayer()->get_unique_id() || data.m_Player != a_PlayerPos.m_Sender)
|
||||
return;
|
||||
|
||||
SetPlayerPositionAndRotation(data.m_Player, data.m_Position, data.m_Rotation);
|
||||
SetPlayerPositionAndRotation(data.m_Player, data.m_Position, data.m_Rotation, data.m_Velocity);
|
||||
}
|
||||
|
||||
void World::AddPlayer(PlayerID a_PlayerId, String a_PlayerName) {
|
||||
@@ -97,11 +97,13 @@ void World::RemovePlayer(PlayerID a_PlayerId) {
|
||||
}
|
||||
}
|
||||
|
||||
void World::SetPlayerPositionAndRotation(PlayerID a_PlayerId, const Vector3& a_Position, const Vector3& a_Rotation) {
|
||||
void World::SetPlayerPositionAndRotation(
|
||||
PlayerID a_PlayerId, const Vector3& a_Position, const Vector3& a_Rotation, const godot::Vector3& a_Velocity) {
|
||||
Player* player = GetPlayerById(a_PlayerId);
|
||||
if (player) {
|
||||
player->set_position(a_Position);
|
||||
player->SetCameraRotation(a_Rotation);
|
||||
player->set_velocity(a_Velocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user